[cups.general] How to send jobs to a SCSI printer with cups?
Mike Fedyk
mfedyk at matchmail.com
Fri Sep 10 19:08:10 PDT 2004
Mike Fedyk wrote:
> Mike Fedyk wrote:
>
>> 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...
>>
>> [1]
>> http://www.danbbs.dk/~dino/SCSI/SCSI2-11.html
>>
> Here's a patch:
> --- scsi-linux.c.orig 2004-09-10 16:14:08.000000000 -0700
> +++ scsi-linux.c 2004-09-10 16:17:20.000000000 -0700
> @@ -185,8 +185,8 @@
> 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[3] = bytes;
> + scsi_cmd[4] = bytes / 256;
> scsi_cmd[5] = 0x00;
>
> for (try = 0; try < 10; try ++)
>
>------------------------------------------------------------------------
>
>--- scsi-linux.c.orig 2004-09-10 16:14:08.000000000 -0700
>+++ scsi-linux.c 2004-09-10 16:17:20.000000000 -0700
>@@ -185,8 +185,8 @@
> 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[3] = bytes;
>+ scsi_cmd[4] = bytes / 256;
> scsi_cmd[5] = 0x00;
>
> for (try = 0; try < 10; try ++)
>
>
Well, if I did find a bug, it looks like this is the proper fix even
though the buffer size is only 8k bytes...
--- scsi-linux.c.orig 2004-09-10 16:14:08.000000000 -0700
+++ scsi-linux.c 2004-09-10 19:02:47.000000000 -0700
@@ -184,9 +184,9 @@
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[3] = bytes / 16777216; /* High 8 bit value of Transfer
Lenght */
+ scsi_cmd[2] = bytes / 65536; /* Middle 8 bit value of
Transfer Lenght */
+ scsi_cmd[4] = bytes / 256; /* Low 8 bit value of Transfer
Lenght */
scsi_cmd[5] = 0x00;
for (try = 0; try < 10; try ++)
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: scsi-linux.c.patch
URL: <https://lists.cups.org/pipermail/cups/attachments/20040910/e096f58f/attachment-0001.ksh>
More information about the cups
mailing list