On 4/30/07, Jiri Kosina <[EMAIL PROTECTED]> wrote:
> On Tue, 1 May 2007, Jiri Kosina wrote:
>
> > Thanks for the report - it clearly shows that Cypress produces different
> > hardware with different report descriptors, all broken in a very similar
> > way (improper order of usage minimum and maximum items), but not
> > identical. This would require more general handling and care ... I will
> > send you updated patch for test.
>
> Bret,
>
> please try the patch below and let me know. It should work with both the
> broken cypress barcode readers, 0xde61 and 0xde64. If you are aware of any
> other product ids which would require similar fixup, please let me know.

I tested a de61 so far on an amd64 (previous testing was on a i386)
and its working
when I grabbed a few scanners to do testing tonight I apparently
missed grabbing a
de64 so I'll test that tomorrow

and at the moment it looks like thats the only ids that are here
I'm sure given enough time unitech will deside to swap chipsets again
and break it again
when that happens you will no doubt hear from me (hopefully with just a patch :)

> diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
> diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c
> index 827a75a..f5ef2e4 100644
> --- a/drivers/usb/input/hid-core.c
> +++ b/drivers/usb/input/hid-core.c
> @@ -650,6 +650,8 @@ void usbhid_init_reports(struct hid_devi
>  #define USB_DEVICE_ID_CYPRESS_MOUSE    0x0001
>  #define USB_DEVICE_ID_CYPRESS_HIDCOM   0x5500
>  #define USB_DEVICE_ID_CYPRESS_ULTRAMOUSE       0x7417
> +#define USB_DEVICE_ID_CYPRESS_BARCODE_1        0xde61
> +#define USB_DEVICE_ID_CYPRESS_BARCODE_2        0xde64
>
>  #define USB_VENDOR_ID_BERKSHIRE                0x0c98
>  #define USB_DEVICE_ID_BERKSHIRE_PCWD   0x1140
> @@ -945,6 +947,9 @@ static const struct hid_blacklist {
>
>         { USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER, 
> HID_QUIRK_SONY_PS3_CONTROLLER },
>
> +       { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1, 
> HID_QUIRK_SWAPPED_MIN_MAX },
> +       { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2, 
> HID_QUIRK_SWAPPED_MIN_MAX },
> +
>         { USB_VENDOR_ID_CIDC, 0x0103, HID_QUIRK_IGNORE },
>
>         { 0, 0 }
> @@ -1053,6 +1058,30 @@ static void hid_fixup_s510_descriptor(un
>         }
>  }
>
> +#define rdesc_swap(n1,n2)      tmp = rdesc[n2]; \
> +                               rdesc[n2] = rdesc[n1]; \
> +                               rdesc[n1] = tmp;

wont someone complain about having a #define in a .c file?

> +static void hid_fixup_cypress_descriptor(unsigned char *rdesc, int rsize)
> +{
> +       char tmp;
> +       short fixed = 0;
> +       int i;
> +
> +       for (i = 0; i < rsize - 4; i++) {
> +               if (rdesc[i] == 0x29 && rdesc [i+2] == 0x19) {
> +                       fixed = 1;
> +                       rdesc[i] = 0x19;
> +                       rdesc[i+2] = 0x29;
> +                       rdesc_swap(i+1, i+3);
> +               }
> +       }
> +
> +       if (fixed)
> +               info("Fixing up Cypress report descriptor");
> +       else
> +               info("Cypress report descriptor didn't require fixup");
> +}
> +
>  static struct hid_device *usb_hid_configure(struct usb_interface *intf)
>  {
>         struct usb_host_interface *interface = intf->cur_altsetting;
> @@ -1129,6 +1158,9 @@ static struct hid_device *usb_hid_config
>         if (quirks & HID_QUIRK_LOGITECH_S510_DESCRIPTOR)
>                 hid_fixup_s510_descriptor(rdesc, rsize);
>
> +       if (quirks & HID_QUIRK_SWAPPED_MIN_MAX)
> +               hid_fixup_cypress_descriptor(rdesc, rsize);
> +
>  #ifdef CONFIG_HID_DEBUG
>         printk(KERN_DEBUG __FILE__ ": report descriptor (size %u, read %d) = 
> ", rsize, n);
>         for (n = 0; n < rsize; n++)
> diff --git a/include/linux/hid.h b/include/linux/hid.h
> index 8c97d4d..0542c24 100644
> --- a/include/linux/hid.h
> +++ b/include/linux/hid.h
> @@ -269,6 +269,7 @@ struct hid_item {
>  #define HID_QUIRK_SONY_PS3_CONTROLLER          0x00080000
>  #define HID_QUIRK_LOGITECH_S510_DESCRIPTOR     0x00100000
>  #define HID_QUIRK_DUPLICATE_USAGES             0x00200000
> +#define HID_QUIRK_SWAPPED_MIN_MAX              0x00400000
>
>  /*
>   * This is the global environment of the parser. This information is
>

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to