diff --git a/backend/dll.conf.in b/backend/dll.conf.in index 3ee542815..8d459ab7b 100644 --- a/backend/dll.conf.in +++ b/backend/dll.conf.in @@ -73,6 +73,7 @@ plustek #pnm qcam ricoh +ricoh2 rts8891 s9036 sceptre diff --git a/backend/ricoh2.c b/backend/ricoh2.c index 616b71969..6c7403a77 100644 --- a/backend/ricoh2.c +++ b/backend/ricoh2.c @@ -106,6 +106,18 @@ typedef struct Ricoh2_Device { } Ricoh2_Device; +typedef struct Ricoh2_device_info { + SANE_Int product_id; + SANE_String_Const device_name; +} +Ricoh2_device_info; + +static Ricoh2_device_info supported_devices[] = { + { 0x042c, "Aficio SP100SU" }, + { 0x0438, "Aficio SG3100SNw" }, + { 0x0448, "Aficio SP111SU" } +}; + static SANE_String_Const mode_list[] = { SANE_VALUE_SCAN_MODE_COLOR, SANE_VALUE_SCAN_MODE_GRAY, @@ -137,14 +149,18 @@ lookup_handle(SANE_Handle handle) return NULL; } -static const char* get_model_by_productid(SANE_Int id) +static SANE_String_Const get_model_by_productid(SANE_Int id) { - switch (id) + size_t i = 0; + for (; i < sizeof (supported_devices) / sizeof (supported_devices[0]); ++i) { - case 0x0448: return "Aficio SP111SU"; - case 0x042c: return "Aficio SP100SU"; - default: return "Unidentified device"; + if (supported_devices[i].product_id == id) + { + return supported_devices[i].device_name; + } } + + return "Unidentified device"; } static SANE_Status @@ -261,6 +277,8 @@ init_options(Ricoh2_Device *dev) SANE_Status sane_init (SANE_Int *vc, SANE_Auth_Callback __sane_unused__ cb) { + size_t i = 0; + DBG_INIT (); DBG(2, "sane_init\n"); @@ -269,8 +287,11 @@ sane_init (SANE_Int *vc, SANE_Auth_Callback __sane_unused__ cb) sanei_usb_set_timeout (USB_TIMEOUT_MS); num_devices = 0; - sanei_usb_find_devices (0x5ca, 0x042c, attach); - sanei_usb_find_devices (0x5ca, 0x0448, attach); + + for (; i < sizeof (supported_devices) / sizeof (supported_devices[0]); ++i) + { + sanei_usb_find_devices (0x5ca, supported_devices[i].product_id, attach); + } if (vc) *vc = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0); diff --git a/doc/Makefile.in b/doc/Makefile.in index b2440f69d..5028adf08 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -416,7 +416,7 @@ BACKEND_5MANS = sane-abaton.5 sane-agfafocus.5 sane-apple.5 sane-as6e.5 \ sane-nec.5 sane-net.5 sane-pie.5 sane-pieusb.5 sane-pint.5 sane-pnm.5 \ sane-umax.5 sane-qcam.5 sane-scsi.5 sane-artec.5 sane-kodak.5 sane-kodakaio.5 \ sane-fujitsu.5 sane-sharp.5 sane-s9036.5 sane-tamarack.5 \ - sane-ricoh.5 sane-ricoh.5 sane-avision.5 sane-plustek.5 sane-st400.5 \ + sane-ricoh.5 sane-ricoh2.5 sane-avision.5 sane-plustek.5 sane-st400.5 \ sane-mustek_pp.5 sane-dc210.5 sane-v4l.5 sane-snapscan.5 \ sane-canon.5 sane-coolscan.5 sane-bh.5 sane-dc240.5 \ sane-umax_pp.5 sane-umax1220u.5 sane-sm3600.5 sane-usb.5 \ diff --git a/doc/descriptions/ricoh2.desc b/doc/descriptions/ricoh2.desc index 585d9e892..55ee3721e 100644 --- a/doc/descriptions/ricoh2.desc +++ b/doc/descriptions/ricoh2.desc @@ -24,17 +24,17 @@ :mfg "Ricoh" ; name a manufacturer :url "http://www.ricoh.com/" ; manufacturer's URL -:model "SP-111SU" ; name models for above-specified mfg. -:status :basic ; :minimal, :basic, :good, :complete - ; :untested, or :unsupported -:interface "USB" ; interface type of the device: - ; "SCSI", "USB", "Parport (EPP)", - ; "Parport (SPP)", "Parport (ECP)", - ; "Serial port", "IEEE-1394", "JetDirect", - ; or "Proprietary". -:usbid "0x05ca" "0x0448" ; Vendor and product ids of an USB device +:model "SG-3100SNw" +:status :basic +:interface "USB" +:usbid "0x05ca" "0x0438" :model "SP-100SU" :status :untested :interface "USB" :usbid "0x05ca" "0x042c" + +:model "SP-111SU" +:status :basic +:interface "USB" +:usbid "0x05ca" "0x0448" diff --git a/doc/sane-ricoh2.man b/doc/sane-ricoh2.man index e32026674..86db7c6a7 100644 --- a/doc/sane-ricoh2.man +++ b/doc/sane-ricoh2.man @@ -9,10 +9,11 @@ library implements a SANE (Scanner Access Now Easy) backend that provides access to the following Ricoh flatbed scanners: .PP .RS +SG-3100SNw +.br SP-100SU .br SP-111SU -.br .RE .PP .SH FILES @@ -51,6 +52,6 @@ environment variable controls the debug level for this backend. Higher debug levels increase the verbosity of the output. .SH "SEE ALSO" -sane(7), sane\-scsi(5) +sane(7), sane\-usb(5) .SH AUTHOR Stanislav Yuzvinsky diff --git a/doc/sane.man b/doc/sane.man index 1ba03cd0a..a9fd50a37 100644 --- a/doc/sane.man +++ b/doc/sane.man @@ -450,7 +450,7 @@ for details. .TP .B ricoh2 The ricoh2 backend provides access to the following Ricoh flatbed -scanners: SP-100SU and SP-111SU. See +scanners: SG-3100SNw, SP-100SU, and SP-111SU. See .BR sane\-ricoh2 (5) for details. .TP