kopia lustrzana https://gitlab.com/sane-project/backends
Merge branch 'genesys-misc' into 'master'
genesys: Miscellaneous changes/improvements See merge request sane-project/backends!53merge-requests/54/head
commit
a569bfbf02
|
@ -6009,8 +6009,8 @@ attach (SANE_String_Const devname, Genesys_Device ** devp, SANE_Bool may_wait)
|
|||
|
||||
if (!dev)
|
||||
{
|
||||
DBG(DBG_error, "%s: vendor %d product %d is not supported by this backend\n", __func__,
|
||||
vendor, product);
|
||||
DBG(DBG_error, "%s: vendor 0x%xd product 0x%xd is not supported by this backend\n", __func__,
|
||||
vendor, product);
|
||||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,8 @@
|
|||
/* Some setup DAC and CCD tables */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
#include "genesys_low.h"
|
||||
|
||||
/** Setup table for various scanners using a Wolfson DAC
|
||||
*/
|
||||
static Genesys_Frontend Wolfson[] = {
|
||||
|
|
|
@ -687,7 +687,7 @@ gl124_send_slope_table (Genesys_Device * dev, int table_nr,
|
|||
|
||||
/* slope table addresses are fixed */
|
||||
status =
|
||||
sanei_genesys_write_ahb (dev->dn, dev->usb_mode, 0x10000000 + 0x4000 * table_nr, steps * 2, table);
|
||||
sanei_genesys_write_ahb(dev->dn, 0x10000000 + 0x4000 * table_nr, steps * 2, table);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG (DBG_error,
|
||||
|
@ -805,11 +805,6 @@ gl124_set_fe (Genesys_Device * dev, uint8_t set)
|
|||
|
||||
RIE (sanei_genesys_read_register (dev, REG0A, &val));
|
||||
|
||||
if(dev->usb_mode<0)
|
||||
{
|
||||
val=3<<REG0AS_SIFSEL;
|
||||
}
|
||||
|
||||
/* route to correct analog FE */
|
||||
switch ((val & REG0A_SIFSEL)>>REG0AS_SIFSEL)
|
||||
{
|
||||
|
@ -2198,12 +2193,6 @@ gl124_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home)
|
|||
|
||||
DBG(DBG_proc, "%s (wait_until_home = %d)\n", __func__, wait_until_home);
|
||||
|
||||
if(dev->usb_mode<0)
|
||||
{
|
||||
DBGCOMPLETED;
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
/* post scan gpio : without that HOMSNR is unreliable */
|
||||
gl124_homsnr_gpio(dev);
|
||||
|
||||
|
@ -2938,7 +2927,7 @@ gl124_send_shading_data (Genesys_Device * dev, uint8_t * data, int size)
|
|||
}
|
||||
RIE (sanei_genesys_read_register (dev, 0xd0+i, &val));
|
||||
addr = val * 8192 + 0x10000000;
|
||||
status = sanei_genesys_write_ahb (dev->dn, dev->usb_mode, addr, pixels*dev->segnb, buffer);
|
||||
status = sanei_genesys_write_ahb(dev->dn, addr, pixels*dev->segnb, buffer);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s; write to AHB failed (%s)\n", __func__, sane_strstatus(status));
|
||||
|
|
|
@ -599,7 +599,7 @@ gl846_send_slope_table (Genesys_Device * dev, int table_nr,
|
|||
}
|
||||
|
||||
/* slope table addresses are fixed */
|
||||
status = sanei_genesys_write_ahb (dev->dn, dev->usb_mode, 0x10000000 + 0x4000 * table_nr, steps * 2, table);
|
||||
status = sanei_genesys_write_ahb(dev->dn, 0x10000000 + 0x4000 * table_nr, steps * 2, table);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: write to AHB failed writing slope table %d (%s)\n", __func__, table_nr,
|
||||
|
@ -1875,12 +1875,6 @@ gl846_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home)
|
|||
|
||||
DBG(DBG_proc, "%s (wait_until_home = %d)\n", __func__, wait_until_home);
|
||||
|
||||
if(dev->usb_mode<0)
|
||||
{
|
||||
DBGCOMPLETED;
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
/* post scan gpio : without that HOMSNR is unreliable */
|
||||
gl846_homsnr_gpio(dev);
|
||||
|
||||
|
@ -2523,7 +2517,7 @@ gl846_send_shading_data (Genesys_Device * dev, uint8_t * data, int size)
|
|||
|
||||
RIEF (sanei_genesys_read_register (dev, 0xd0+i, &val), buffer);
|
||||
addr = val * 8192 + 0x10000000;
|
||||
status = sanei_genesys_write_ahb (dev->dn, dev->usb_mode, addr, pixels, buffer);
|
||||
status = sanei_genesys_write_ahb(dev->dn, addr, pixels, buffer);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s; write to AHB failed (%s)\n", __func__, sane_strstatus(status));
|
||||
|
|
|
@ -622,7 +622,7 @@ gl847_send_slope_table (Genesys_Device * dev, int table_nr,
|
|||
|
||||
/* slope table addresses are fixed */
|
||||
status =
|
||||
sanei_genesys_write_ahb (dev->dn, dev->usb_mode, 0x10000000 + 0x4000 * table_nr, steps * 2, table);
|
||||
sanei_genesys_write_ahb(dev->dn, 0x10000000 + 0x4000 * table_nr, steps * 2, table);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s: write to AHB failed writing slope table %d (%s)\n", __func__, table_nr,
|
||||
|
@ -2582,7 +2582,7 @@ gl847_send_shading_data (Genesys_Device * dev, uint8_t * data, int size)
|
|||
|
||||
RIE (sanei_genesys_read_register (dev, 0xd0+i, &val));
|
||||
addr = val * 8192 + 0x10000000;
|
||||
status = sanei_genesys_write_ahb (dev->dn, dev->usb_mode, addr, pixels, buffer);
|
||||
status = sanei_genesys_write_ahb(dev->dn, addr, pixels, buffer);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG(DBG_error, "%s; write to AHB failed (%s)\n", __func__, sane_strstatus(status));
|
||||
|
|
|
@ -1049,13 +1049,13 @@ sanei_genesys_bulk_write_register (Genesys_Device * dev,
|
|||
/**
|
||||
* writes a block of data to AHB
|
||||
* @param dn USB device index
|
||||
* @param usb_mode usb mode : -1, fake usb, 1 usb 1.1, 2 usb 2.0
|
||||
* @param usb_mode usb mode : 1 usb 1.1, 2 usb 2.0
|
||||
* @param addr AHB address to write to
|
||||
* @param size size of the chunk of data
|
||||
* @param data pointer to the data to write
|
||||
*/
|
||||
SANE_Status
|
||||
sanei_genesys_write_ahb (SANE_Int dn, int usb_mode, uint32_t addr, uint32_t size, uint8_t * data)
|
||||
sanei_genesys_write_ahb (SANE_Int dn, uint32_t addr, uint32_t size, uint8_t * data)
|
||||
{
|
||||
uint8_t outdata[8];
|
||||
size_t written,blksize;
|
||||
|
@ -1082,13 +1082,6 @@ sanei_genesys_write_ahb (SANE_Int dn, int usb_mode, uint32_t addr, uint32_t size
|
|||
DBG (DBG_io, "%s: %s\n", __func__, msg);
|
||||
}
|
||||
|
||||
/* no effective write if fake USB */
|
||||
if(usb_mode<0)
|
||||
{
|
||||
DBGCOMPLETED;
|
||||
return status;
|
||||
}
|
||||
|
||||
/* write addr and size for AHB */
|
||||
status =
|
||||
sanei_usb_control_msg (dn, REQUEST_TYPE_OUT, REQUEST_BUFFER, VALUE_BUFFER,
|
||||
|
@ -1258,7 +1251,7 @@ sanei_genesys_send_gamma_table (Genesys_Device * dev)
|
|||
RIEF (sanei_genesys_write_register (dev, 0xc5+2*i, gamma[size*2*i+1]), gamma);
|
||||
RIEF (sanei_genesys_write_register (dev, 0xc6+2*i, gamma[size*2*i]), gamma);
|
||||
|
||||
status = sanei_genesys_write_ahb (dev->dn, dev->usb_mode, 0x01000000 + 0x200 * i, (size-1) * 2, gamma + i * size * 2+2);
|
||||
status = sanei_genesys_write_ahb(dev->dn, 0x01000000 + 0x200 * i, (size-1) * 2, gamma + i * size * 2+2);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG (DBG_error,
|
||||
|
@ -1295,25 +1288,22 @@ sanei_genesys_asic_init (Genesys_Device * dev, int max_regs)
|
|||
DBGSTART;
|
||||
|
||||
/* URB 16 control 0xc0 0x0c 0x8e 0x0b len 1 read 0x00 */
|
||||
if(dev->usb_mode>=0)
|
||||
status = sanei_usb_control_msg (dev->dn, REQUEST_TYPE_IN, REQUEST_REGISTER, VALUE_GET_REGISTER, 0x00, 1, &val);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
status = sanei_usb_control_msg (dev->dn, REQUEST_TYPE_IN, REQUEST_REGISTER, VALUE_GET_REGISTER, 0x00, 1, &val);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG (DBG_error, "%s: request register failed %s\n", __func__,
|
||||
sane_strstatus (status));
|
||||
return status;
|
||||
}
|
||||
DBG (DBG_io2, "%s: value=0x%02x\n", __func__, val);
|
||||
DBG (DBG_info, "%s: device is %s\n", __func__, (val & 0x08) ? "USB 1.0" : "USB2.0");
|
||||
if (val & 0x08)
|
||||
{
|
||||
dev->usb_mode = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dev->usb_mode = 2;
|
||||
}
|
||||
DBG (DBG_error, "%s: request register failed %s\n", __func__,
|
||||
sane_strstatus (status));
|
||||
return status;
|
||||
}
|
||||
DBG (DBG_io2, "%s: value=0x%02x\n", __func__, val);
|
||||
DBG (DBG_info, "%s: device is %s\n", __func__, (val & 0x08) ? "USB 1.0" : "USB2.0");
|
||||
if (val & 0x08)
|
||||
{
|
||||
dev->usb_mode = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dev->usb_mode = 2;
|
||||
}
|
||||
|
||||
/* setup gamma tables */
|
||||
|
|
|
@ -203,8 +203,14 @@
|
|||
#define BULK_RAM 0x00
|
||||
#define BULK_REGISTER 0x11
|
||||
|
||||
#define BULKIN_MAXSIZE 0xFE00
|
||||
#define GL646_BULKIN_MAXSIZE 0xFFC0
|
||||
/* Genesys supports 0xFE00 maximum size in general, wheraus GL646 supports
|
||||
0xFFC0. We use 0xF000 because that's the packet limit in the Linux usbmon
|
||||
USB capture stack. By default it limits packet size to b_size / 5 where
|
||||
b_size is the size of the ring buffer. By default it's 300*1024, so the
|
||||
packet is limited 61440 without any visibility to acquiring software.
|
||||
*/
|
||||
#define BULKIN_MAXSIZE 0xF000
|
||||
#define GL646_BULKIN_MAXSIZE 0xF000
|
||||
#define GL646_BULKIN_MINSIZE 0x0800
|
||||
#define BULKOUT_MAXSIZE 0xF000
|
||||
|
||||
|
@ -771,8 +777,13 @@ struct Genesys_Device
|
|||
SANE_Int dn;
|
||||
SANE_Word vendorId; /**< USB vendor identifier */
|
||||
SANE_Word productId; /**< USB product identifier */
|
||||
SANE_Int usb_mode; /**< USB mode: 1 for USB 1.1, 2 for USB 2.0,
|
||||
0 unset and -1 for fake USB device */
|
||||
|
||||
// USB mode:
|
||||
// 0: not set
|
||||
// 1: USB 1.1
|
||||
// 2: USB 2.0
|
||||
SANE_Int usb_mode;
|
||||
|
||||
SANE_String file_name;
|
||||
SANE_String calib_file;
|
||||
Genesys_Model *model;
|
||||
|
@ -948,7 +959,7 @@ extern SANE_Status sanei_genesys_get_status (Genesys_Device * dev, uint8_t * sta
|
|||
extern void sanei_genesys_print_status (uint8_t val);
|
||||
|
||||
extern SANE_Status
|
||||
sanei_genesys_write_ahb (SANE_Int dn, int usb_mode, uint32_t addr, uint32_t size, uint8_t * data);
|
||||
sanei_genesys_write_ahb(SANE_Int dn, uint32_t addr, uint32_t size, uint8_t * data);
|
||||
|
||||
extern void sanei_genesys_init_fe (Genesys_Device * dev);
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue