diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-03-30 21:30:45 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-03-30 21:30:45 +0200 |
commit | ee770c2346eb37e0dcb8b6cf3eaacf3d8efd6bbc (patch) | |
tree | 58f05092be1a17a939e861f8cadcda1b6ca2ecef /backend/mustek_usb2_asic.c | |
parent | 0da9e21872802cfc6e975b1ebaf9efb9e5934d84 (diff) | |
parent | fef76e17ed4c607ea73b81279f9ef1d7121be900 (diff) |
Merge branch 'release/experimental/1.0.29-1_experimental1'experimental/1.0.29-1_experimental1
Diffstat (limited to 'backend/mustek_usb2_asic.c')
-rw-r--r-- | backend/mustek_usb2_asic.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/backend/mustek_usb2_asic.c b/backend/mustek_usb2_asic.c index d9b1a28..b31c749 100644 --- a/backend/mustek_usb2_asic.c +++ b/backend/mustek_usb2_asic.c @@ -42,7 +42,7 @@ whether to permit this exception to apply to your modifications. If you do not wish that, delete this exception notice. - This file implements a SANE backend for the Mustek BearPaw 2448 TA Pro + This file implements a SANE backend for the Mustek BearPaw 2448 TA Pro and similar USB2 scanners. */ #include "mustek_usb2_asic.h" @@ -255,6 +255,7 @@ Mustek_DMARead (PAsic chip, unsigned int size, SANE_Byte * lpdata) STATUS status = STATUS_GOOD; unsigned int i, buf[1]; unsigned int read_size; + size_t read_size_usb; DBG (DBG_ASIC, "Mustek_DMARead: Enter\n"); @@ -268,9 +269,11 @@ Mustek_DMARead (PAsic chip, unsigned int size, SANE_Byte * lpdata) SetRWSize (chip, 1, buf[0]); status = WriteIOControl (chip, 0x03, 0, 4, (SANE_Byte *) (buf)); + read_size_usb = buf[0]; status = sanei_usb_read_bulk (chip->fd, lpdata + i * read_size, - (size_t *) buf); + &read_size_usb); + buf[0] = read_size_usb; if (status != STATUS_GOOD) { DBG (DBG_ERR, "Mustek_DMARead: read error\n"); @@ -284,9 +287,11 @@ Mustek_DMARead (PAsic chip, unsigned int size, SANE_Byte * lpdata) SetRWSize (chip, 1, buf[0]); status = WriteIOControl (chip, 0x03, 0, 4, (SANE_Byte *) (buf)); + read_size_usb = buf[0]; status = sanei_usb_read_bulk (chip->fd, lpdata + i * read_size, - (size_t *) buf); + &read_size_usb); + buf[0] = read_size_usb; if (status != STATUS_GOOD) { DBG (DBG_ERR, "Mustek_DMARead: read error\n"); @@ -307,6 +312,7 @@ Mustek_DMAWrite (PAsic chip, unsigned int size, SANE_Byte * lpdata) unsigned int buf[1]; unsigned int i; unsigned int write_size; + size_t write_size_usb; DBG (DBG_ASIC, "Mustek_DMAWrite: Enter:size=%d\n", size); @@ -320,9 +326,11 @@ Mustek_DMAWrite (PAsic chip, unsigned int size, SANE_Byte * lpdata) SetRWSize (chip, 0, buf[0]); WriteIOControl (chip, 0x02, 0, 4, (SANE_Byte *) buf); + write_size_usb = buf[0]; status = sanei_usb_write_bulk (chip->fd, lpdata + i * write_size, - (size_t *) buf); + &write_size_usb); + buf[0] = write_size_usb; if (status != STATUS_GOOD) { DBG (DBG_ERR, "Mustek_DMAWrite: write error\n"); @@ -337,9 +345,11 @@ Mustek_DMAWrite (PAsic chip, unsigned int size, SANE_Byte * lpdata) SetRWSize (chip, 0, buf[0]); WriteIOControl (chip, 0x02, 0, 4, (SANE_Byte *) buf); + write_size_usb = buf[0]; status = sanei_usb_write_bulk (chip->fd, lpdata + i * write_size, - (size_t *) buf); + &write_size_usb); + buf[0] = write_size_usb; if (status != STATUS_GOOD) { DBG (DBG_ERR, "Mustek_DMAWrite: write error\n"); @@ -1649,7 +1659,7 @@ LLFMotorMove (PAsic chip, LLF_MOTORMOVE * LLF_MotorMove) Mustek_SendData (chip, ES01_E5_MotorDecStep, LLF_MotorMove->DecStep); DBG (DBG_ASIC, "DecStep=%d\n", LLF_MotorMove->DecStep); - /*set motor uniform speed only for uniform speed + /*set motor uniform speed only for uniform speed //only used for UNIFORM_MOTOR_AND_SCAN_SPEED_ENABLE //If you use acc mode, this two reg are not used. */ Mustek_SendData (chip, ES01_FD_MotorFixedspeedLSB, @@ -4541,7 +4551,7 @@ Asic_ReadCalibrationData (PAsic chip, void * pBuffer, pCalBuffer = (SANE_Byte *) malloc (dwXferBytes); if (pCalBuffer == NULL) { - DBG (DBG_ERR, + DBG (DBG_ERR, "Asic_ReadCalibrationData: Can't malloc bCalBuffer memory\n"); return STATUS_MEM_ERROR; } |