wok-stable annotate sane-backends/stuff/xerox_mfp_fix_usb_devices.patch @ rev 12315

Add TiMidity++ (libao 1.1.0)
author Richard Dunbar <mojo@slitaz.org>
date Fri Aug 10 20:53:49 2012 +0000 (2012-08-10)
parents
children
rev   line source
mojo@12307 1 commit 5ea227caeacd504b64eef301e83fa63e0a25b3f7
mojo@12307 2 Author: Alex Belkin <abc@telekom.ru>
mojo@12307 3 Date: Tue Mar 8 17:57:19 2011 +0300
mojo@12307 4
mojo@12307 5 keep usb device by default (correct for bug introduced by tcp sub-backend
mojo@12307 6
mojo@12307 7 diff --git a/backend/xerox_mfp.c b/backend/xerox_mfp.c
mojo@12307 8 index e08b50f..d4672a7 100644
mojo@12307 9 --- a/backend/xerox_mfp.c
mojo@12307 10 +++ b/backend/xerox_mfp.c
mojo@12307 11 @@ -37,10 +37,10 @@
mojo@12307 12 static const SANE_Device **devlist = NULL; /* sane_get_devices array */
mojo@12307 13 static struct device *devices_head = NULL; /* sane_get_devices list */
mojo@12307 14
mojo@12307 15 -transport available_transports[] = {
mojo@12307 16 +enum { TRANSPORT_USB, TRANSPORT_TCP, TRANSPORTS_MAX };
mojo@12307 17 +transport available_transports[TRANSPORTS_MAX] = {
mojo@12307 18 { "usb", usb_dev_request, usb_dev_open, usb_dev_close, usb_configure_device },
mojo@12307 19 { "tcp", tcp_dev_request, tcp_dev_open, tcp_dev_close, tcp_configure_device },
mojo@12307 20 - { 0 }
mojo@12307 21 };
mojo@12307 22
mojo@12307 23 static int resolv_state(int state)
mojo@12307 24 @@ -824,7 +824,13 @@ free_devices (void)
mojo@12307 25 devices_head = NULL;
mojo@12307 26 }
mojo@12307 27
mojo@12307 28 -/* SANE API ignores return code of this callback */
mojo@12307 29 +static transport *tr_from_devname(SANE_String_Const devname)
mojo@12307 30 +{
mojo@12307 31 + if (strncmp("tcp", devname, 3) == 0)
mojo@12307 32 + return &available_transports[TRANSPORT_TCP];
mojo@12307 33 + return &available_transports[TRANSPORT_USB];
mojo@12307 34 +}
mojo@12307 35 +
mojo@12307 36 static SANE_Status
mojo@12307 37 list_one_device (SANE_String_Const devname)
mojo@12307 38 {
mojo@12307 39 @@ -839,12 +845,7 @@ list_one_device (SANE_String_Const devname)
mojo@12307 40 return SANE_STATUS_GOOD;
mojo@12307 41 }
mojo@12307 42
mojo@12307 43 - for (tr = available_transports; tr->ttype; tr++) {
mojo@12307 44 - if (!strncmp (devname, tr->ttype, strlen(tr->ttype)))
mojo@12307 45 - break;
mojo@12307 46 - }
mojo@12307 47 - if (!tr->ttype)
mojo@12307 48 - return SANE_STATUS_INVAL;
mojo@12307 49 + tr = tr_from_devname(devname);
mojo@12307 50
mojo@12307 51 dev = calloc (1, sizeof (struct device));
mojo@12307 52 if (dev == NULL)
mojo@12307 53 @@ -878,13 +879,7 @@ list_one_device (SANE_String_Const devname)
mojo@12307 54 static SANE_Status
mojo@12307 55 list_conf_devices (UNUSED (SANEI_Config * config), const char *devname)
mojo@12307 56 {
mojo@12307 57 - transport *tr;
mojo@12307 58 -
mojo@12307 59 - for (tr = available_transports; tr->ttype; tr++) {
mojo@12307 60 - if (!strncmp (devname, tr->ttype, strlen(tr->ttype)))
mojo@12307 61 - return tr->configure_device(devname, list_one_device);
mojo@12307 62 - }
mojo@12307 63 - return SANE_STATUS_INVAL;
mojo@12307 64 + return tr_from_devname(devname)->configure_device(devname, list_one_device);
mojo@12307 65 }
mojo@12307 66
mojo@12307 67 SANE_Status