Fixed a bug in the USB autodetection.

DEVEL_2_0_BRANCH-1
Gerhard Jaeger 2002-03-16 17:57:16 +00:00
rodzic 9677319a3e
commit b00749b800
2 zmienionych plików z 9 dodań i 7 usunięć

Wyświetl plik

@ -46,6 +46,8 @@
* 0.42 - added adjustment stuff
* added custom gamma tables
* fixed a problem with the "size-sliders"
* fixed a bug that causes segfault when using the autodetection for USB
* devices
*
*.............................................................................
*
@ -1113,7 +1115,6 @@ static SANE_Status attach( const char *dev_name, pCnfDef cnf,
dev->name = strdup(dev_name); /* hold it double to avoid */
dev->sane.name = dev->name; /* compiler warnings */
dev->sane.vendor = "Plustek";
dev->usbId = NULL;
memcpy( &dev->adj, &cnf->adj, sizeof(AdjDef));
@ -1154,7 +1155,7 @@ static SANE_Status attach( const char *dev_name, pCnfDef cnf,
dev->readImage = usbDev_readImage;
dev->shutdown = usbDev_shutdown;
dev->usbId = strdup( cnf->usbId );
strncpy( dev->usbId, cnf->usbId, _MAX_ID_LEN );
if( cnf->adj.warmup >= 0 )
dev->usbDev.dwWarmup = cnf->adj.warmup;
@ -1432,9 +1433,6 @@ void sane_exit( void )
if( dev->sane.name )
free( dev->name );
if( dev->usbId )
free( dev->usbId );
if( dev->res_list )
free( dev->res_list );
free( dev );

Wyświetl plik

@ -35,6 +35,8 @@
* 0.40 - added USB stuff
* 0.41 - added configuration stuff
* 0.42 - added custom gamma tables
* changed usbId to static array
* added _MAX_ID_LEN
*
*.............................................................................
*
@ -117,6 +119,8 @@
#define _NEG_X ((double)_NegativePageWidth/300.0 * MM_PER_INCH)
#define _NEG_Y ((double)_NegativePageHeight/300.0 * MM_PER_INCH)
#define _MAX_ID_LEN 20
/************************ some structures ************************************/
enum {
@ -169,7 +173,7 @@ typedef struct Plustek_Device
struct itimerval saveSettings; /* for lamp timer */
/**************************** USB-stuff **********************************/
char *usbId; /* pointer to Vendor and product*/
char usbId[_MAX_ID_LEN];/* to keep Vendor and product */
/* ID string (from conf) file */
#ifdef _PLUSTEK_USB
ScanDef scanning; /* here we hold all stuff for */
@ -241,7 +245,7 @@ typedef struct {
char devName[PATH_MAX];
PORTTYPE porttype;
char usbId[20];
char usbId[_MAX_ID_LEN];
/* contains the stuff to adjust... */
AdjDef adj;