next up previous contents index
次へ: sane_strstatus 上へ: Operations 戻る: sane_set_io_mode   目次   索引

sane_get_select_fd

This function is used to obtain a (platform-specific) file-descriptor for handle h that is readable if and only if image data is available (i.e., when a call to sane_read() will return at least one byte of data). If the call completes successfully, the select file-descriptor is returned in *fd.

SANE_Status sane_get_select_fd (SANE_Handle h, SANE_Int *fd);
This function can be called only after a call to sane_start() has been performed and the returned file-descriptor is guaranteed to remain valid for the duration of the current image acquisition (i.e., until sane_cancel() or sane_start() get called again or until sane_read() returns with status SANE_STATUS_EOF). Indeed, a backend must guarantee to close the returned select file descriptor at the point when the next sane_read() call would return SANE_STATUS_EOF. This is necessary to ensure the application can detect when this condition occurs without actually having to call sane_read().

A backend may elect not to support this operation. In such a case, the function returns with status code SANE_STATUS_UNSUPPORTED.

Note that the only operation supported by the returned file-descriptor is a host operating-system dependent test whether the file-descriptor is readable (e.g., this test can be implemented using select() or poll() under UNIX). If any other operation is performed on the file descriptor, the behavior of the backend becomes unpredictable. Once the file-descriptor signals ``readable'' status, it will remain in that state until a call to sane_read() is performed. Since many input devices are very slow, support for this operation is strongly encouraged as it permits an application to do other work while image acquisition is in progress.

This function may fail with one of the following status codes:

SANE_STATUS_INVAL:
No image acquisition is pending.
SANE_STATUS_UNSUPPORTED:
The backend does not support this operation.


next up previous contents index
次へ: sane_strstatus 上へ: Operations 戻る: sane_set_io_mode   目次   索引
MATSUBAYASHI 'Shaolin' Kohji 平成14年10月29日