8 #include <linux/module.h>
9 #include <linux/parport.h>
10 #include <linux/ctype.h>
11 #include <linux/string.h>
12 #include <linux/slab.h>
13 #include <asm/uaccess.h>
19 {
"",
"Legacy device" },
20 {
"PRINTER",
"Printer" },
22 {
"NET",
"Network device" },
23 {
"HDC",
"Hard disk" },
24 {
"PCMCIA",
"PCMCIA" },
25 {
"MEDIA",
"Multimedia device" },
26 {
"FDC",
"Floppy disk" },
28 {
"SCANNER",
"Scanner" },
29 {
"DIGICAM",
"Digital camera" },
30 {
"",
"Unknown device" },
31 {
"",
"Unspecified" },
32 {
"SCSIADAPTER",
"SCSI adapter" },
43 printk (
" (addr %d)", device);
52 static void parse_data(
struct parport *port,
int device,
char *
str)
73 u = sep +
strlen (sep) - 1;
74 while (u >= p && *u ==
' ')
92 for (u = sep; *
u; u++)
94 for (i = 0; classes[
i].token; i++) {
102 }
else if (!
strcmp(p,
"CMD") ||
103 !
strcmp(p,
"COMMAND SET")) {
110 }
else if (!
strcmp(p,
"DES") || !
strcmp(p,
"DESCRIPTION")) {
125 info->
class = guessed_class;
127 pretty_print (port, device);
139 unsigned lelen, belen;
142 unsigned current_idlen;
156 memcpy(buffer, length, 2);
161 belen = (length[0] << 8) + length[1];
162 lelen = (length[1] << 8) + length[0];
163 idlens[0] =
min(belen, lelen);
164 idlens[1] = idlens[0]+2;
165 if (belen != lelen) {
170 idlens[off] =
max(belen, lelen);
171 idlens[off+1] = idlens[off]+2;
178 if (idlens[0] == 0 || idlens[0] > 0xFFF) {
180 " length of %#zX bytes\n",
181 port->
name, idlens[0]);
190 for (current_idlen = 0; current_idlen < numidlens; ++current_idlen) {
191 size_t idlen = idlens[current_idlen];
192 if (idlen+1 >= count)
204 " while device told it would be %d"
206 port->
name, len, belen);
215 if (buffer[len-1] ==
';') {
217 " before device told data not available. "
218 "Current idlen %u of %u, len bytes %02X %02X\n",
219 port->
name, current_idlen, numidlens,
220 length[0], length[1]);
224 if (current_idlen < numidlens) {
236 idlen = idlens[current_idlen];
238 while(len2 < idlen && retval > 0) {
241 min(
sizeof tmp, idlen-len2));
273 retval = parport_read_device_id (dev->
port, buffer, count);
276 parse_data (dev->
port, dev->
daisy, buffer+2);