~ubuntu-branches/debian/jessie/sane-backends/jessie

« back to all changes in this revision

Viewing changes to debian/patches/xerox_mfp_fix_usb_devices.patch

  • Committer: Package Import Robot
  • Author(s): Markus Koschany
  • Date: 2013-07-04 17:41:47 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20130704174147-tl5tzd8bwvmctka2
Tags: 1.0.23-1
* QA upload.
* New upstream release.
* This package has been orphaned. Set maintainer to the Debian QA Group.
* Bump compat level to 9 (was 5) and require debhelper >= 9.
* debian/control:
  - sane-utils: Inherit Section: graphics from source package sane-backends.
  - Remove versioned dependencies. They are trivially satisfied.
* Drop the following patches. They are merged upstream now.
  - fix_v4l_build.patch
  - hurd_path_max_fix.patch
  - sane_desc_udev+acl.patch
  - scanimage_man_batch_start.patch
  - udev_usb_suspend.patch
  - xerox_mfp_add_scx_4623fw.patch
  - xerox_mfp_fix_usb_device.patch
* Drop disable_rpath.patch because the RPATH is already removed by chrpath
  in debian/rules.
* Rebase and refresh all other patches against the new upstream relase.
* debian/rules:
  - Simplify debian/rules by using dh sequencer.
  - Build with --parallel and with autotools_dev.
  - Enable all hardening build flags.
  - Install umax_pp with sane-utils.install.
* Build-Depend on libtiff5-dev. Thanks to Michael Terry for the patch.
  (Closes: #681079)
* Build-Depend on libusb-1.0-0-dev and enable libusb1.0 support in
  debian/rules. Thanks to Martin Pitt for the report and Whoopie for the
  patch. (Closes: #687137)

Show diffs side-by-side

added added

removed removed

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