With this patch using Epson 1240U works for me in both USB2.0 (NEC) and USB1.1 (AMD OCHI). I am not using CONFIG_USB_DYNAMIC_MINORS or devfs.
Now the scn_minor is not manged at all, separate scn_index variable used. This one even survives taking the scanner offline and back on. Should I really start using CONFIG_USB_DYNAMIC_MINORS instead of making this work without it ? --- Kari Hämeenaho --- linux-2.5.42/drivers/usb/image/scanner.h Sat Oct 12 07:21:42 2002 +++ linux-2.5.42-kjh/drivers/usb/image/scanner.h Sat Oct 12 13:10:35 2002 @@ -216,7 +216,7 @@ #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 +#define USB_SCN_MINOR(X) minor((X)->i_rdev) #ifdef DEBUG #define SCN_DEBUG(X) X --- linux-2.5.42/drivers/usb/image/scanner.c Sat Oct 12 07:21:36 2002 +++ linux-2.5.42-kjh/drivers/usb/image/scanner.c Sat Oct 12 13:15:52 2002 @@ -385,6 +385,7 @@ struct usb_device *dev; int scn_minor; + int scn_index; int err=0; @@ -393,17 +394,18 @@ down(&scn_mutex); scn_minor = USB_SCN_MINOR(inode); + scn_index = scn_minor - SCN_BASE_MNR; dbg("open_scanner: scn_minor:%d", scn_minor); - if (!p_scn_table[scn_minor]) { + if (!p_scn_table[scn_index]) { up(&scn_mutex); MOD_DEC_USE_COUNT; err("open_scanner(%d): Unable to access minor data", scn_minor); return -ENODEV; } - scn = p_scn_table[scn_minor]; + scn = p_scn_table[scn_index]; dev = scn->scn_dev; @@ -452,19 +454,21 @@ struct scn_usb_data *scn; int scn_minor; + int scn_index; scn_minor = USB_SCN_MINOR (inode); + scn_index = scn_minor - SCN_BASE_MNR; dbg("close_scanner: scn_minor:%d", scn_minor); - if (!p_scn_table[scn_minor]) { + if (!p_scn_table[scn_index]) { err("close_scanner(%d): invalid scn_minor", scn_minor); return -ENODEV; } down(&scn_mutex); - scn = p_scn_table[scn_minor]; + scn = p_scn_table[scn_index]; down(&(scn->sem)); scn->isopen = 0; @@ -690,15 +694,17 @@ struct usb_device *dev; int scn_minor; + int scn_index; scn_minor = USB_SCN_MINOR(inode); + scn_index = scn_minor - SCN_BASE_MNR; - if (!p_scn_table[scn_minor]) { + if (!p_scn_table[scn_index]) { err("ioctl_scanner(%d): invalid scn_minor", scn_minor); return -ENODEV; } - dev = p_scn_table[scn_minor]->scn_dev; + dev = p_scn_table[scn_index]->scn_dev; switch (cmd) { @@ -830,6 +836,7 @@ int ep_cnt; int ix; int scn_minor; + int scn_index; int retval; char valid_device = 0; @@ -978,9 +985,10 @@ up(&scn_mutex); return -ENOMEM; } + scn_index = scn_minor - SCN_BASE_MNR; /* Check to make sure that the last slot isn't already taken */ - if (p_scn_table[scn_minor]) { + if (p_scn_table[scn_index]) { err("probe_scanner: No more minor devices remaining."); up(&scn_mutex); return -ENOMEM; @@ -1080,7 +1088,7 @@ if (scn->devfs == NULL) dbg("scanner%d: device node registration failed", scn_minor); - p_scn_table[scn_minor] = scn; + p_scn_table[scn_index] = scn; up(&scn_mutex); @@ -1091,6 +1099,8 @@ static void disconnect_scanner(struct usb_interface *intf) { + int scn_index; + struct scn_usb_data *scn = dev_get_drvdata(&intf->dev); dev_set_drvdata(&intf->dev, NULL); @@ -1111,7 +1121,8 @@ dbg("disconnect_scanner: De-allocating minor:%d", scn->scn_minor); devfs_unregister(scn->devfs); usb_deregister_dev(1, scn->scn_minor); - p_scn_table[scn->scn_minor] = NULL; + scn_index = scn->scn_minor - SCN_BASE_MNR; + p_scn_table[scn_index] = NULL; usb_free_urb(scn->scn_irq); up (&(scn->sem)); kfree (scn); ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel