[3548] in linux-scsi channel archive

home help back first fref pref prev next nref lref last post

suggested (minor but important to the sane project) extension to sg driver

daemon@ATHENA.MIT.EDU (Thomas Vogler)
Tue Mar 17 08:19:22 1998

Date: 	Tue, 17 Mar 1998 14:18:30 +0100
From: Thomas Vogler <tvo@software-ag.de>
To: linux-scsi@vger.rutgers.edu
Reply-To: tvo@software-ag.de

hi list,

i found your mail address in the MAINTAINERS file for the linux 2.0.x
kernels. i hope this is the right forum for my suggestion, if not,
please point me to the right people for asking...

i would kindly like to ask for some additions to the sg driver. there
is a field 'twelve_byte' in the sg header to force vendor specific
commands to be 12 bytes. my need is it to force the driver to use 6
bytes since i have to program a canon scanner 2700f which is using 6
byte scsi commands for some of its vendor specific commands.

all my chnages are based on linux 2.0.32.

after my modification, sg_header in file linux/include/scsi/sg.h looks
like this:

struct sg_header
 {
  int pack_len;    /* length of incoming packet <4096 (including header) */
  int reply_len;   /* maximum length <4096 of expected reply */
  int pack_id;     /* id number of packet */
  int result;      /* 0==ok, otherwise refer to errno codes */
  unsigned int twelve_byte:1; /* Force 12 byte command length for group 6 & 7 commands  */
  unsigned int six_byte:1;  /* Force 6 byte command length for group 6 & 7 commands  */
  unsigned int other_flags:30;			/* for future use */
  unsigned char sense_buffer[16]; /* used only by reads */
  /* command follows then data for command */
 };

in order to support it in the driver the file sg.c needs to be
modified around line 373 as follows:

    /*
     * Now we need to grab the command itself from the user's buffer.
     */
    opcode = get_user(buf);
    size=COMMAND_SIZE(opcode);
    if (opcode >= 0xc0 && device->header.six_byte) size = 6;
    if (opcode >= 0xc0 && device->header.twelve_byte) size = 12;

do you agree to my changes and what would be the way to make them part
of future linux kernels ?

or can you come up with a better solution ?

tia

thomas


-- 
+----------------------------------------------------------------------------+
| T. Vogler, mailto:tvo@software-ag.de, http://pcool/~tvo/                   |
+----------------------------------------------------------------------------+
| Phone: [49]-(6151)-92-0                           FAX: [49]-(6151)-92-1287 |
+----------------------------------------------------------------------------+
| long main = 0xc8c70ff0;       /* halt your Pentium the hard way */         |
+----------------------------------------------------------------------------+
| PGP fingerprint: A4 D4 2A 60 B5 48 0F 43  3F EB C5 AC 96 79 A8 D2          |
+----------------------------------------------------------------------------+
| statements in here are my own and not neccesarily those of my employer     |
+----------------------------------------------------------------------------+

-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.rutgers.edu

home help back first fref pref prev next nref lref last post