usblp.c (3a37471551cd3b287ce7f02ed25bcf8ec37a191d) | usblp.c (21470e32ca7f976bf131aa3c7b54019d07f7d821) |
---|---|
1/* 2 * usblp.c 3 * 4 * Copyright (c) 1999 Michael Gee <michael@linuxspecific.com> 5 * Copyright (c) 1999 Pavel Machek <pavel@ucw.cz> 6 * Copyright (c) 2000 Randy Dunlap <rdunlap@xenotime.net> 7 * Copyright (c) 2000 Vojtech Pavlik <vojtech@suse.cz> 8 # Copyright (c) 2001 Pete Zaitcev <zaitcev@redhat.com> --- 280 unchanged lines hidden (view full) --- 289#define usblp_reset(usblp)\ 290 usblp_ctrl_msg(usblp, USBLP_REQ_RESET, USB_TYPE_CLASS, USB_DIR_OUT, USB_RECIP_OTHER, 0, NULL, 0) 291 292#define usblp_hp_channel_change_request(usblp, channel, buffer) \ 293 usblp_ctrl_msg(usblp, USBLP_REQ_HP_CHANNEL_CHANGE_REQUEST, USB_TYPE_VENDOR, USB_DIR_IN, USB_RECIP_INTERFACE, channel, buffer, 1) 294 295/* 296 * See the description for usblp_select_alts() below for the usage | 1/* 2 * usblp.c 3 * 4 * Copyright (c) 1999 Michael Gee <michael@linuxspecific.com> 5 * Copyright (c) 1999 Pavel Machek <pavel@ucw.cz> 6 * Copyright (c) 2000 Randy Dunlap <rdunlap@xenotime.net> 7 * Copyright (c) 2000 Vojtech Pavlik <vojtech@suse.cz> 8 # Copyright (c) 2001 Pete Zaitcev <zaitcev@redhat.com> --- 280 unchanged lines hidden (view full) --- 289#define usblp_reset(usblp)\ 290 usblp_ctrl_msg(usblp, USBLP_REQ_RESET, USB_TYPE_CLASS, USB_DIR_OUT, USB_RECIP_OTHER, 0, NULL, 0) 291 292#define usblp_hp_channel_change_request(usblp, channel, buffer) \ 293 usblp_ctrl_msg(usblp, USBLP_REQ_HP_CHANNEL_CHANGE_REQUEST, USB_TYPE_VENDOR, USB_DIR_IN, USB_RECIP_INTERFACE, channel, buffer, 1) 294 295/* 296 * See the description for usblp_select_alts() below for the usage |
297 * explanation. Look into your /proc/bus/usb/devices and dmesg in | 297 * explanation. Look into your /sys/kernel/debug/usb/devices and dmesg in |
298 * case of any trouble. 299 */ 300static int proto_bias = -1; 301 302/* 303 * URB callback. 304 */ 305 --- 928 unchanged lines hidden (view full) --- 1234 * 1235 * If nothing else, we bind to USB_CLASS_PRINTER/1/1 1236 * - the unidirectional interface. 1237 */ 1238static int usblp_select_alts(struct usblp *usblp) 1239{ 1240 struct usb_interface *if_alt; 1241 struct usb_host_interface *ifd; | 298 * case of any trouble. 299 */ 300static int proto_bias = -1; 301 302/* 303 * URB callback. 304 */ 305 --- 928 unchanged lines hidden (view full) --- 1234 * 1235 * If nothing else, we bind to USB_CLASS_PRINTER/1/1 1236 * - the unidirectional interface. 1237 */ 1238static int usblp_select_alts(struct usblp *usblp) 1239{ 1240 struct usb_interface *if_alt; 1241 struct usb_host_interface *ifd; |
1242 struct usb_endpoint_descriptor *epd, *epwrite, *epread; 1243 int p, i, e; | 1242 struct usb_endpoint_descriptor *epwrite, *epread; 1243 int p, i; 1244 int res; |
1244 1245 if_alt = usblp->intf; 1246 1247 for (p = 0; p < USBLP_MAX_PROTOCOLS; p++) 1248 usblp->protocol[p].alt_setting = -1; 1249 1250 /* Find out what we have. */ 1251 for (i = 0; i < if_alt->num_altsetting; i++) { 1252 ifd = &if_alt->altsetting[i]; 1253 1254 if (ifd->desc.bInterfaceClass != USB_CLASS_PRINTER || 1255 ifd->desc.bInterfaceSubClass != 1) 1256 if (!(usblp->quirks & USBLP_QUIRK_BAD_CLASS)) 1257 continue; 1258 1259 if (ifd->desc.bInterfaceProtocol < USBLP_FIRST_PROTOCOL || 1260 ifd->desc.bInterfaceProtocol > USBLP_LAST_PROTOCOL) 1261 continue; 1262 | 1245 1246 if_alt = usblp->intf; 1247 1248 for (p = 0; p < USBLP_MAX_PROTOCOLS; p++) 1249 usblp->protocol[p].alt_setting = -1; 1250 1251 /* Find out what we have. */ 1252 for (i = 0; i < if_alt->num_altsetting; i++) { 1253 ifd = &if_alt->altsetting[i]; 1254 1255 if (ifd->desc.bInterfaceClass != USB_CLASS_PRINTER || 1256 ifd->desc.bInterfaceSubClass != 1) 1257 if (!(usblp->quirks & USBLP_QUIRK_BAD_CLASS)) 1258 continue; 1259 1260 if (ifd->desc.bInterfaceProtocol < USBLP_FIRST_PROTOCOL || 1261 ifd->desc.bInterfaceProtocol > USBLP_LAST_PROTOCOL) 1262 continue; 1263 |
1263 /* Look for bulk OUT and IN endpoints. */ 1264 epwrite = epread = NULL; 1265 for (e = 0; e < ifd->desc.bNumEndpoints; e++) { 1266 epd = &ifd->endpoint[e].desc; 1267 1268 if (usb_endpoint_is_bulk_out(epd)) 1269 if (!epwrite) 1270 epwrite = epd; 1271 1272 if (usb_endpoint_is_bulk_in(epd)) 1273 if (!epread) 1274 epread = epd; | 1264 /* Look for the expected bulk endpoints. */ 1265 if (ifd->desc.bInterfaceProtocol > 1) { 1266 res = usb_find_common_endpoints(ifd, 1267 &epread, &epwrite, NULL, NULL); 1268 } else { 1269 epread = NULL; 1270 res = usb_find_bulk_out_endpoint(ifd, &epwrite); |
1275 } 1276 1277 /* Ignore buggy hardware without the right endpoints. */ | 1271 } 1272 1273 /* Ignore buggy hardware without the right endpoints. */ |
1278 if (!epwrite || (ifd->desc.bInterfaceProtocol > 1 && !epread)) | 1274 if (res) |
1279 continue; 1280 | 1275 continue; 1276 |
1281 /* 1282 * Turn off reads for USB_CLASS_PRINTER/1/1 (unidirectional) 1283 * interfaces and buggy bidirectional printers. 1284 */ 1285 if (ifd->desc.bInterfaceProtocol == 1) { 1286 epread = NULL; 1287 } else if (usblp->quirks & USBLP_QUIRK_BIDIR) { | 1277 /* Turn off reads for buggy bidirectional printers. */ 1278 if (usblp->quirks & USBLP_QUIRK_BIDIR) { |
1288 printk(KERN_INFO "usblp%d: Disabling reads from " 1289 "problematic bidirectional printer\n", 1290 usblp->minor); 1291 epread = NULL; 1292 } 1293 1294 usblp->protocol[ifd->desc.bInterfaceProtocol].alt_setting = 1295 ifd->desc.bAlternateSetting; --- 160 unchanged lines hidden --- | 1279 printk(KERN_INFO "usblp%d: Disabling reads from " 1280 "problematic bidirectional printer\n", 1281 usblp->minor); 1282 epread = NULL; 1283 } 1284 1285 usblp->protocol[ifd->desc.bInterfaceProtocol].alt_setting = 1286 ifd->desc.bAlternateSetting; --- 160 unchanged lines hidden --- |