[cups.general] How to send jobs to a SCSI printer with cups?

Michael Sweet mike at easysw.com
Fri Sep 10 19:56:21 PDT 2004


Mike Fedyk wrote:
> Mike Fedyk wrote:
> 
>> Mike Fedyk wrote:
>>
>>> Michael Sweet wrote:
>>>
>>>> Mike Fedyk wrote:
>>>>
>>>>> What can I do to find what commands are having trouble with the 
>>>>> scsi printer?
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> There is only one command we issue, the group 0 print command,
>>>> along with the total number of bytes in the current buffer (8k in
>>>> the current implementation).
>>>
>>>
>>>
>>>
>>> Is that a 6 byte or 10 byte command?
>>>
>>> Trying to find more info about the device with sg3-utils, it looks 
>>> like it doesn't like 6 byte scsi commands.
>>
>>
> Is this right?
> 
> In scsi-linux.c at line 185:
> 
>      scsi_cmd[0] = 0x0a;       /* Group 0 print command */
>      scsi_cmd[1] = 0x00;
>      scsi_cmd[2] = bytes / 65536;
>      scsi_cmd[3] = bytes / 256;
>      scsi_cmd[4] = bytes;
>      scsi_cmd[5] = 0x00;
> 
> According to [1], the format should be
> 
> Operation code (0Ah)
> LUN
> MSB
> Transfer Length
> LSB
> Control
> 
> I don't know if the linux scsi stack changes the orders of the fields 
> though...

The order is correct as specified: bytes / 65536 gives you bits 16-23,
bytes / 256 gives you bits 8-15, and bytes gives you bits 0-7.

 From the page you referenced:

   11.2.2 PRINT command

   The PRINT command (see table 208) transfers the specified number of
   bytes from the initiator to the target to be printed.

   Table 208 - PRINT command

 
+=====-========-========-========-========-========-========-========-========+
   |  Bit|   7    |   6    |   5    |   4    |   3    |   2    |   1 
|   0    |
   |Byte |        |        |        |        |        |        | 
|        |
 
|=====+=======================================================================|
   | 0   |                           Operation code (0Ah) 
          |
 
|-----+-----------------------------------------------------------------------|
   | 1   | Logical unit number      |                  Reserved 
          |
 
|-----+-----------------------------------------------------------------------|
   | 2   | (MSB) 
          |
   |-----+--- 
       ---|
   | 3   |                           Transfer length 
          |
   |-----+--- 
       ---|
   | 4   | 
    (LSB) |
 
|-----+-----------------------------------------------------------------------|
   | 5   |                           Control 
          |
 
+=============================================================================+ 


   The transfer length specifies the length in bytes of data that shall
   be transferred during the DATA OUT phase. A transfer length of zero
   indicates that no data shall be transferred. This condition shall
   not be considered as error.

So, the current code is correct.

-- 
______________________________________________________________________
Michael Sweet, Easy Software Products           mike at easysw dot com
Printing Software for UNIX                       http://www.easysw.com




More information about the cups mailing list