Add support for Aficio SG3100SNw

merge-requests/57/head
Stanislav Yuzvinsky 2019-05-01 01:14:45 +03:00
rodzic fa940e86bb
commit 3514d06156
4 zmienionych plików z 35 dodań i 8 usunięć

Wyświetl plik

@ -106,6 +106,18 @@ typedef struct Ricoh2_Device {
} }
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[] = {
{ 0x0448, "Aficio SP111SU" },
{ 0x042c, "Aficio SP100SU" },
{ 0x0438, "Aficio SG3100SNw" }
};
static SANE_String_Const mode_list[] = { static SANE_String_Const mode_list[] = {
SANE_VALUE_SCAN_MODE_COLOR, SANE_VALUE_SCAN_MODE_COLOR,
SANE_VALUE_SCAN_MODE_GRAY, SANE_VALUE_SCAN_MODE_GRAY,
@ -137,14 +149,18 @@ lookup_handle(SANE_Handle handle)
return NULL; 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"; if (supported_devices[i].product_id == id)
case 0x042c: return "Aficio SP100SU"; {
default: return "Unidentified device"; return supported_devices[i].device_name;
}
} }
return "Unidentified device";
} }
static SANE_Status static SANE_Status
@ -261,6 +277,8 @@ init_options(Ricoh2_Device *dev)
SANE_Status SANE_Status
sane_init (SANE_Int *vc, SANE_Auth_Callback __sane_unused__ cb) sane_init (SANE_Int *vc, SANE_Auth_Callback __sane_unused__ cb)
{ {
size_t i = 0;
DBG_INIT (); DBG_INIT ();
DBG(2, "sane_init\n"); 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); sanei_usb_set_timeout (USB_TIMEOUT_MS);
num_devices = 0; 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) if (vc)
*vc = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0); *vc = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0);

Wyświetl plik

@ -38,3 +38,8 @@
:status :untested :status :untested
:interface "USB" :interface "USB"
:usbid "0x05ca" "0x042c" :usbid "0x05ca" "0x042c"
:model "SG-3100SNw"
:status :basic
:interface "USB"
:usbid "0x05ca" "0x0438"

Wyświetl plik

@ -13,6 +13,7 @@ SP-100SU
.br .br
SP-111SU SP-111SU
.br .br
SG-3100SNw
.RE .RE
.PP .PP
.SH FILES .SH FILES

Wyświetl plik

@ -450,7 +450,7 @@ for details.
.TP .TP
.B ricoh2 .B ricoh2
The ricoh2 backend provides access to the following Ricoh flatbed The ricoh2 backend provides access to the following Ricoh flatbed
scanners: SP-100SU and SP-111SU. See scanners: SP-100SU, SP-111SU, and SG-3100SNw. See
.BR sane\-ricoh2 (5) .BR sane\-ricoh2 (5)
for details. for details.
.TP .TP