wok-current annotate sane-backends/stuff/xerox_mfp_fix_usb_devices.patch @ rev 20311

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