[sane-devel] RFC: proposal for an improved sanei_scsi library

Henning Meier-Geinitz henning@meier-geinitz.de
Mon, 9 Dec 2002 19:53:37 +0100


On Sun, Dec 08, 2002 at 05:51:17PM +0100, abel deuring wrote:
> >I hope It won't take too long to finish the core points of SANE2.
> Sounds promising.

Proposals/corrections/comments welcome :-)

> >SCSI reference manual for a scanner? Haha. Never seen such a beast.
> >Either it's labeled "top secret" or it's written in Chinese. At least
> >for "my" backends. :-)
> Well, to be fair, some vendors are more helpful. I needed just one phone 
> call to get the docs from Sharp; Fujitsu has many docs available at 
> least on their European website; Epson publishes even some of their 
> source code.

I got some stuff about USB from Mustek but not for SCSI.

> /** Macros for the parameter direction of sanei2_scsi_req_enter and sanei2_scsi_cmd
>  *
>  * @param SANEI_SCSI_DXFER_NONE  no data transfer
>  * @param SANEI_SCSI_DXFER_TO_DEVICE data is sent to the device
>  * @param SANEI_SCSI__DXFER_FROM_DEVICE data is received from the device
>  */

These are not parameters (@param), but that's just formatting stuff.
Have a look at the HTML pages generated by your header to find out
(copy to include/sane/sanei_scsi2.h or whatever, install doxygen, cd doc, run doxygen
doxygen-sanei.con, view html files in doc/sanei-html)
If you have some time :-)

> /** Wait for SCSI command
>  *
>  * Wait for the completion of the SCSI command with id ID.  
>  *
>  * @param id id used in sanei2_scsi_req_enter()
>  * @param sb pointer to a SANE_Byte array, where the SCSI sense data may be

just byte (or u_int8_t). 

>  *           stored. The caller must allocate the necessary memory.
>  *	     The parameter may be NULL.

> extern SANE_Status sanei2_scsi_req_wait (void *id, u_int_8 *sb, size_t *sblen,
>                                         int *scsi_status);


> /** Send SCSI command
>  *
>  * This is a convenience function that is equivalent to a pair of
>  * sanei2_scsi_req_enter()/sanei2_scsi_req_wait() calls.
>  *
>  * @param fd file descriptor
>  * @param cmd pointer to SCSI command
>  * @param cmd_size size of the command
>  * @param buffer pointer to the buffer with data to be sent to / received from
>           the scanner
>  * @param buffer_size size of the data buffer
>  * @param direction direction of the data transfer. Allowed value:
>  *	  - SANE_SCSI_DXFER_NONE  no data transfer
>  *        - SANE_SCSI_DXFER_TO_DEVICE data is sent to the device
>  *	  - SANE_SCSI_DXFER_FROM_DEVICE data is received from the device

Already explained separately.

>  * @param sb pointer to a SANE_Byte array, where the SCSI sense data may be

See above.

>  * @param scsi_status_valid If *scsi_status_valid is non-zero, *scsi_status
>  *	     contains valid information; if it is zero, *scsi_status is 
>  *           invalid.

See cmd_wait (-1!)

> extern SANE_Status sanei2_scsi_cmd (int fd,
> 				   const void * cmd, size_t cmd_size,
> 				   const void * buffer, size_t buffer_size,
> 				   int direction, SANE_Byte *sb, size_t *sblen,

u_int8_t *sb

> 				   SANE_Byte *scsi_status);

int *scsi_status