kopia lustrzana https://gitlab.com/sane-project/backends
Merge branch 'fix-pixma-get-devices' into 'master'
pixma: Fix device enumeration for open devices See merge request sane-project/backends!540merge-requests/540/merge
commit
3c9b46a096
|
@ -243,6 +243,30 @@ cleanup_device_list (void)
|
||||||
dev_list = NULL;
|
dev_list = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static SANE_Bool
|
||||||
|
pixma_fixup_serial(SANE_Device *sdev)
|
||||||
|
{
|
||||||
|
struct pixma_sane_t * ss;
|
||||||
|
size_t cdev_len;
|
||||||
|
const char *open_dev_id;
|
||||||
|
|
||||||
|
cdev_len = strlen(sdev->name);
|
||||||
|
for (ss = first_scanner; ss; ss = ss->next)
|
||||||
|
{
|
||||||
|
open_dev_id = pixma_get_string (ss->s, PIXMA_STRING_ID);
|
||||||
|
if (strlen(open_dev_id) > cdev_len &&
|
||||||
|
strncmp(open_dev_id, sdev->name, cdev_len) == 0)
|
||||||
|
{
|
||||||
|
PDBG (pixma_dbg (3, "pixma_fixup_serial() change name from %s to %s\n",
|
||||||
|
sdev->name, open_dev_id));
|
||||||
|
free_block ((const void *) sdev->name);
|
||||||
|
sdev->name = strdup (open_dev_id);
|
||||||
|
return SANE_TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return SANE_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
find_scanners (SANE_Bool local_only)
|
find_scanners (SANE_Bool local_only)
|
||||||
{
|
{
|
||||||
|
@ -274,8 +298,10 @@ find_scanners (SANE_Bool local_only)
|
||||||
sdev->model = model;
|
sdev->model = model;
|
||||||
sdev->vendor = vendor_str;
|
sdev->vendor = vendor_str;
|
||||||
sdev->type = type_str;
|
sdev->type = type_str;
|
||||||
|
pixma_fixup_serial (sdev);
|
||||||
dev_list[i] = sdev;
|
dev_list[i] = sdev;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* dev_list is already NULL terminated by calloc(). */
|
/* dev_list is already NULL terminated by calloc(). */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue