ChangeSet 1.823.3.11, 2002/11/12 17:14:43-08:00, khaho@koti.soon.fi [PATCH] Re: USB scanner fix for 2.5.47 was not good ? Bad news is that the scanner endpoint change did not work, maybe I mistested it or it never worked. My version worked, but was very ugly. Here is a working one (against 2.5.47), this also looks nicer (I did not know the EP_XXX() could be changed too): diff -Nru a/drivers/usb/image/scanner.c b/drivers/usb/image/scanner.c --- a/drivers/usb/image/scanner.c Thu Nov 14 14:12:35 2002 +++ b/drivers/usb/image/scanner.c Thu Nov 14 14:12:35 2002 @@ -840,7 +840,7 @@ struct usb_device *dev = interface_to_usbdev (intf); struct scn_usb_data *scn; struct usb_host_interface *interface; - struct usb_host_endpoint *endpoint; + struct usb_endpoint_descriptor *endpoint; int ep_cnt; int ix; @@ -911,7 +911,6 @@ } interface = intf->altsetting; - endpoint = &interface->endpoint[0]; /* * Start checking for two bulk endpoints OR two bulk endpoints *and* one @@ -929,22 +928,23 @@ ep_cnt = have_bulk_in = have_bulk_out = have_intr = 0; while (ep_cnt < interface->desc.bNumEndpoints) { + endpoint = &interface->endpoint[ep_cnt].desc; - if (!have_bulk_in && IS_EP_BULK_IN(endpoint[ep_cnt])) { + if (!have_bulk_in && IS_EP_BULK_IN(endpoint)) { ep_cnt++; have_bulk_in = ep_cnt; dbg("probe_scanner: bulk_in_ep:%d", have_bulk_in); continue; } - if (!have_bulk_out && IS_EP_BULK_OUT(endpoint[ep_cnt])) { + if (!have_bulk_out && IS_EP_BULK_OUT(endpoint)) { ep_cnt++; have_bulk_out = ep_cnt; dbg("probe_scanner: bulk_out_ep:%d", have_bulk_out); continue; } - if (!have_intr && IS_EP_INTR(endpoint[ep_cnt])) { + if (!have_intr && IS_EP_INTR(endpoint)) { ep_cnt++; have_intr = ep_cnt; dbg("probe_scanner: intr_ep:%d", have_intr); diff -Nru a/drivers/usb/image/scanner.h b/drivers/usb/image/scanner.h --- a/drivers/usb/image/scanner.h Thu Nov 14 14:12:35 2002 +++ b/drivers/usb/image/scanner.h Thu Nov 14 14:12:35 2002 @@ -211,10 +211,10 @@ MODULE_DEVICE_TABLE (usb, scanner_device_ids); -#define IS_EP_BULK(ep) ((ep).desc.bmAttributes == USB_ENDPOINT_XFER_BULK ? 1 : 0) -#define IS_EP_BULK_IN(ep) (IS_EP_BULK(ep) && ((ep).desc.bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN) -#define IS_EP_BULK_OUT(ep) (IS_EP_BULK(ep) && ((ep).desc.bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT) -#define IS_EP_INTR(ep) ((ep).desc.bmAttributes == USB_ENDPOINT_XFER_INT ? 1 : 0) +#define IS_EP_BULK(ep) ((ep)->bmAttributes == USB_ENDPOINT_XFER_BULK ? 1 : 0) +#define IS_EP_BULK_IN(ep) (IS_EP_BULK(ep) && ((ep)->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN) +#define IS_EP_BULK_OUT(ep) (IS_EP_BULK(ep) && ((ep)->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT) +#define IS_EP_INTR(ep) ((ep)->bmAttributes == USB_ENDPOINT_XFER_INT ? 1 : 0) #define USB_SCN_MINOR(X) minor((X)->i_rdev) - SCN_BASE_MNR