From 5a1d5a62ee3b1a5a95fb780883be5f569e9f5bec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Voltz?= Date: Sun, 10 Mar 2013 22:06:52 +0100 Subject: [PATCH] guard against device that went missing in claim/release interface - add test for missing devices in claim or release - changlog entry for all the sanei_usb work --- ChangeLog | 10 ++++++++++ sanei/sanei_usb.c | 11 ++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2729e6eb4..1e18b04ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2013-03-24 Stéphane Voltz + backend/genesys.c: make use of the new sanei_usb_scan_devices function + in sane_get_devices. + +2013-03-24 Stéphane Voltz + * sanei/sanei_usb.c include/sane/sanei_usb.h: + separate device search logic from usb init by creating a + sanei_usb_scan_devices. Add a sanei_usb_exit function to free + allocated resources by sanei_usb_init. + 2013-03-21 Rolf Bensch * backend/pixma_mp150.c, doc/descriptions/pixma.desc, doc/sane-pixma.man: New scanner Canon Pixma MP230 reported by Petar Dodev. diff --git a/sanei/sanei_usb.c b/sanei/sanei_usb.c index 6d1a3332a..98e45ac75 100644 --- a/sanei/sanei_usb.c +++ b/sanei/sanei_usb.c @@ -2899,6 +2899,11 @@ sanei_usb_claim_interface (SANE_Int dn, SANE_Int interface_number) dn); return SANE_STATUS_INVAL; } + if (devices[dn].missing) + { + DBG (1, "sanei_usb_claim_interface: device dn=%d is missing\n", dn); + return SANE_STATUS_INVAL; + } DBG (5, "sanei_usb_claim_interface: interface_number = %d\n", interface_number); @@ -2962,7 +2967,11 @@ sanei_usb_release_interface (SANE_Int dn, SANE_Int interface_number) dn); return SANE_STATUS_INVAL; } - + if (devices[dn].missing) + { + DBG (1, "sanei_usb_release_interface: device dn=%d is missing\n", dn); + return SANE_STATUS_INVAL; + } DBG (5, "sanei_usb_release_interface: interface_number = %d\n", interface_number); if (devices[dn].method == sanei_usb_method_scanner_driver)