On Friday 09 March 2007 09:34:29 Alexey Eremenko wrote: > Is there a way to check for Lightscribe capability?
Not that easily, to what i know. You can use the (GUI) tools at http://www.lightscribe.com to check whether your drive supports it. Or for commandline .. as there also is a SDK with a documented API a simple tool for this could look like the one i just yet wrote and attached (be warned, i have no such drive and so this not tested at all .. just some codepeace of crap that _could_ work .. at your own risk of course ;-). But you'll still need the SDK and system libs installed (from lightscribe.com) for this to work/compile. If this works for you.. and there are more interested in a commandline tool like this (that also may get extended a bit to check for capabilites like color or monochrome printing etc.) i might build a rpm in the openSUSE buildservice from it.. so, any feedback is appreciated (as always ;-) Have fun, Frank P.S.: Please no flames for the codequality.. i know its crappy. I haven't written C++ for ages (at least it feels like that).
/* lschk: is a extremely simple check if drives with lightscribe technology * are present in the system. * * Author: Frank Seidel <[EMAIL PROTECTED]> * Version: 0.1alpha * Date: 09-03-2007 * License: GPLv2 */ #include <stdlib.h> #include <lightscribe.h> #include <iostream> using namespace std; int main(int, char**) { int ret_val = EXIT_SUCCESS; unsigned long drive_counter = 0UL; unsigned long drive_index = 0UL; size_t strSize = 0; char *name = NULL; char *path = NULL; /* get discprintmgr */ LS_DiscPrintMgrHandle myDiscPrintMgr; if (LS_DiscPrintMgr_Create( &myDiscPrintMgr) != LS_OK) { ret_val = EXIT_FAILURE; goto out; } /* enumeration of ls drives */ LS_EnumDiscPrintersHandle ls_enum; if (LS_DiscPrintMgr_EnumDiscPrinters(myDiscPrintMgr, &ls_enum) != LS_OK) { ret_val = EXIT_FAILURE; goto out; } if (LS_EnumDiscPrinters_Count(ls_enum, &drive_counter) != LS_OK) { ret_val = EXIT_FAILURE; goto out; } cout << "Drives detected with lightScribe capabilities: " << drive_counter << endl; LS_DiscPrinterHandle myDrive; for (;drive_index < drive_counter; ++drive_index) { if (LS_EnumDiscPrinters_Item(ls_enum, drive_index, &myDrive) != LS_OK) { ret_val = EXIT_FAILURE; goto out; } if (LS_DiscPrinter_GetPrinterDisplayNameSize(myDrive, &strSize) != LS_OK) { ret_val = EXIT_FAILURE; goto out; } if ((name = (char*) malloc(strSize)) == NULL) { ret_val = EXIT_FAILURE; goto out; } if (LS_DiscPrinter_GetPrinterDisplayName(myDrive, name)!= LS_OK) { free(name); ret_val = EXIT_FAILURE; goto out; } if (LS_DiscPrinter_GetPrinterPathSize(myDrive, &strSize) != LS_OK) { free(name); ret_val = EXIT_FAILURE; goto out; } if ((path = (char*) malloc(strSize)) == NULL) { free(name); ret_val = EXIT_FAILURE; goto out; } if (LS_DiscPrinter_GetPrinterPath(myDrive, path) != LS_OK) { free(path); free(name); ret_val = EXIT_FAILURE; goto out; } cout << "Drive[" << drive_index << "]: " << name << " (" << path << ")" <<endl; free(path); free(name); if (LS_DiscPrinter_Destroy(&myDrive) != LS_OK) { ret_val = EXIT_FAILURE; goto out; } } /* some cleanup */ if ((LS_EnumDiscPrinters_Destroy( &ls_enum) != LS_OK) || (LS_DiscPrintMgr_Destroy( &myDiscPrintMgr) != LS_OK) ) ret_val = EXIT_FAILURE; out: if (ret_val) { cerr << "Error occured while scanning for lightScribe capable drives." << endl; LS_LastChanceCleanup(); } return ret_val; }
all: lschk lschk: lschk.cpp g++ -g -W -Wall -pthread -llightscribe -lpthread -o lschk lschk.cpp clean: rm -fv lschk
pgpt0r8W6hc1N.pgp
Description: PGP signature