patch-src_simple-scan_vala 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. $OpenBSD: patch-src_simple-scan_vala,v 1.4 2017/04/13 07:31:18 ajacoutot Exp $
  2. No gusb on OpenBSD.
  3. --- src/simple-scan.vala.orig Sun Sep 13 23:35:03 2015
  4. +++ src/simple-scan.vala Sat Oct 24 11:40:31 2015
  5. @@ -31,7 +31,6 @@ public class SimpleScan : Gtk.Application
  6. private ScanDevice? default_device = null;
  7. private bool have_devices = false;
  8. - private GUsb.Context usb_context;
  9. private UserInterface ui;
  10. private Scanner scanner;
  11. private Book book;
  12. @@ -62,17 +61,6 @@ public class SimpleScan : Gtk.Application
  13. scanner.scan_failed.connect (scanner_failed_cb);
  14. scanner.scanning_changed.connect (scanner_scanning_changed_cb);
  15. - try
  16. - {
  17. - usb_context = new GUsb.Context ();
  18. - usb_context.device_added.connect (() => { scanner.redetect (); });
  19. - usb_context.device_removed.connect (() => { scanner.redetect (); });
  20. - }
  21. - catch (Error e)
  22. - {
  23. - warning ("Failed to create USB context: %s\n", e.message);
  24. - }
  25. -
  26. if (default_device != null)
  27. {
  28. List<ScanDevice> device_list = null;
  29. @@ -95,7 +83,6 @@ public class SimpleScan : Gtk.Application
  30. base.shutdown ();
  31. book = null;
  32. ui = null;
  33. - usb_context = null;
  34. scanner.free ();
  35. }
  36. @@ -180,36 +167,8 @@ public class SimpleScan : Gtk.Application
  37. public string? suggest_driver ()
  38. {
  39. - if (usb_context == null)
  40. - return null;
  41. -
  42. - var driver_map = new HashTable <uint32, string> (direct_hash, direct_equal);
  43. - add_devices (driver_map, brscan_devices, "brscan");
  44. - add_devices (driver_map, brscan2_devices, "brscan2");
  45. - add_devices (driver_map, brscan3_devices, "brscan3");
  46. - add_devices (driver_map, brscan4_devices, "brscan4");
  47. - add_devices (driver_map, samsung_devices, "samsung");
  48. - add_devices (driver_map, hpaio_devices, "hpaio");
  49. - add_devices (driver_map, epkowa_devices, "epkowa");
  50. - var devices = GUsb.context_get_devices (usb_context);
  51. - /* Fixed in GUsb 0.2.7: https://github.com/hughsie/libgusb/commit/83a6b1a20653c1a17f0a909f08652b5e1df44075 */
  52. - /*var devices = GUSB.context_get_devices (context);*/
  53. - for (var i = 0; i < devices.length; i++)
  54. - {
  55. - var device = devices.data[i];
  56. - var driver = driver_map.lookup (device.get_vid () << 16 | device.get_pid ());
  57. - if (driver != null)
  58. - return driver;
  59. - }
  60. -
  61. return null;
  62. }
  63. -
  64. - private void add_devices (HashTable<uint32, string> map, uint32[] devices, string driver)
  65. - {
  66. - for (var i = 0; i < devices.length; i++)
  67. - map.insert (devices[i], driver);
  68. - }
  69. private void authorize_cb (Scanner scanner, string resource)
  70. {