kopia lustrzana https://gitlab.com/sane-project/backends
Merge branch '781-inconsistent-buffer-size-description-in-manpage' into 'master'
Resolve "Inconsistent --buffer-size description in manpage" Closes #781 and #782 See merge request sane-project/backends!857merge-requests/860/head
commit
c43485dd21
|
@ -2154,6 +2154,24 @@ sane_read_internal (struct hp5590_scanner * scanner, SANE_Byte * data,
|
|||
max_length,
|
||||
scanner->transferred_image_size);
|
||||
|
||||
/*
|
||||
* We will truncate down the buffer size to *under* what the
|
||||
* internal USB reading buffer can supply. This will avoid page read issues
|
||||
* at the end of the buffer.
|
||||
*
|
||||
* See: https://gitlab.com/sane-project/backends/-/issues/781
|
||||
*
|
||||
*/
|
||||
if (max_length > BULK_READ_PAGE_SIZE * MAX_READ_PAGES)
|
||||
{
|
||||
DBG (DBG_proc, "%s, truncating sane_read buffer from %u to %u\n",
|
||||
__func__,
|
||||
max_length,
|
||||
BULK_READ_PAGE_SIZE * MAX_READ_PAGES);
|
||||
|
||||
max_length = BULK_READ_PAGE_SIZE * MAX_READ_PAGES;
|
||||
}
|
||||
|
||||
SANE_Int length_limited = 0;
|
||||
*length = max_length;
|
||||
if ((unsigned long long) *length > scanner->transferred_image_size)
|
||||
|
|
|
@ -99,9 +99,15 @@ struct usb_in_usb_ctrl_setup {
|
|||
#define CORE_FLAG_NOT_READY 1 << 1
|
||||
|
||||
/* Bulk transfers are done in pages, below their respective sizes */
|
||||
/*
|
||||
* Note that we limit the amount we can supply to sane_read() to avoid
|
||||
* clashes with the size of the internal read buffer.
|
||||
*
|
||||
*/
|
||||
#define BULK_WRITE_PAGE_SIZE 0x0f000
|
||||
#define BULK_READ_PAGE_SIZE 0x10000
|
||||
#define ALLOCATE_BULK_READ_PAGES 16 /* 16 * 65536 = 1Mb */
|
||||
#define ALLOCATE_BULK_READ_PAGES 17 /* 16 * 65536 = 1Mb */
|
||||
#define MAX_READ_PAGES 16 /* maximum that we will return to sane_read() */
|
||||
|
||||
/* Structure describing bulk read state, because bulk reads will be done in
|
||||
* pages, but function caller uses its own buffer, whose size is certainly
|
||||
|
|
Ładowanie…
Reference in New Issue