|
From: Vojtech P. <vo...@us...> - 2001-12-27 10:37:44
|
Update of /cvsroot/linuxconsole/ruby/linux/drivers/input
In directory usw-pr-cvs1:/tmp/cvs-serv31725
Modified Files:
hid-core.c hid.h joydev.c usbkbd.c usbmouse.c
Log Message:
Make the HID drivers work on 2.5.1 again.
Index: hid-core.c
===================================================================
RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/input/hid-core.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- hid-core.c 2001/12/10 17:01:44 1.34
+++ hid-core.c 2001/12/27 10:37:41 1.35
@@ -979,7 +979,7 @@
hid->dr.length = cpu_to_le16(hid->urbctrl.transfer_buffer_length);
hid->dr.requesttype = USB_TYPE_CLASS | USB_RECIP_INTERFACE | dir;
- hid->dr.request = dir ? USB_REQ_GET_REPORT : USB_REQ_SET_REPORT;
+ hid->dr.request = dir ? HID_REQ_GET_REPORT : HID_REQ_SET_REPORT;
hid->dr.index = cpu_to_le16(hid->ifnum);
hid->dr.value = ((report->type + 1) << 8) | report->id;
@@ -1030,6 +1030,14 @@
hid_submit_ctrl(hid);
}
+static int hid_get_class_descriptor(struct usb_device *dev, int ifnum,
+ unsigned char type, void *buf, int size)
+{
+ return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
+ USB_REQ_GET_DESCRIPTOR, USB_RECIP_INTERFACE | USB_DIR_IN,
+ (type << 8), ifnum, buf, size, HZ * USB_CTRL_GET_TIMEOUT);
+}
+
int hid_open(struct hid_device *hid)
{
if (hid->open++)
@@ -1127,14 +1135,14 @@
if ((hid_blacklist[n].idVendor == dev->descriptor.idVendor) &&
(hid_blacklist[n].idProduct == dev->descriptor.idProduct)) return NULL;
- if (usb_get_extra_descriptor(interface, USB_DT_HID, &hdesc) && ((!interface->bNumEndpoints) ||
- usb_get_extra_descriptor(&interface->endpoint[0], USB_DT_HID, &hdesc))) {
+ if (usb_get_extra_descriptor(interface, HID_DT_HID, &hdesc) && ((!interface->bNumEndpoints) ||
+ usb_get_extra_descriptor(&interface->endpoint[0], HID_DT_HID, &hdesc))) {
dbg("class descriptor not present\n");
return NULL;
}
for (n = 0; n < hdesc->bNumDescriptors; n++)
- if (hdesc->desc[n].bDescriptorType == USB_DT_REPORT)
+ if (hdesc->desc[n].bDescriptorType == HID_DT_REPORT)
rsize = le16_to_cpu(hdesc->desc[n].wDescriptorLength);
if (!rsize || rsize > HID_MAX_DESCRIPTOR_SIZE) {
@@ -1145,7 +1153,7 @@
{
__u8 rdesc[rsize];
- if ((n = usb_get_class_descriptor(dev, interface->bInterfaceNumber, USB_DT_REPORT, 0, rdesc, rsize)) < 0) {
+ if ((n = hid_get_class_descriptor(dev, interface->bInterfaceNumber, HID_DT_REPORT, rdesc, rsize)) < 0) {
dbg("reading report descriptor failed");
return NULL;
}
Index: hid.h
===================================================================
RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/input/hid.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- hid.h 2001/11/07 08:12:49 1.23
+++ hid.h 2001/12/27 10:37:41 1.24
@@ -39,6 +39,25 @@
#define USB_INTERFACE_CLASS_HID 3
/*
+ * HID class requests
+ */
+
+#define HID_REQ_GET_REPORT 0x01
+#define HID_REQ_GET_IDLE 0x02
+#define HID_REQ_GET_PROTOCOL 0x03
+#define HID_REQ_SET_REPORT 0x09
+#define HID_REQ_SET_IDLE 0x0A
+#define HID_REQ_SET_PROTOCOL 0x0B
+
+/*
+ * HID class descriptor types
+ */
+
+#define HID_DT_HID (USB_TYPE_CLASS | 0x01)
+#define HID_DT_REPORT (USB_TYPE_CLASS | 0x02)
+#define HID_DT_PHYSICAL (USB_TYPE_CLASS | 0x03)
+
+/*
* We parse each description item into this structure. Short items data
* values are expanded to 32-bit signed int, long items contain a pointer
* into the data area.
Index: joydev.c
===================================================================
RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/input/joydev.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- joydev.c 2001/12/26 21:08:33 1.37
+++ joydev.c 2001/12/27 10:37:41 1.38
@@ -468,7 +468,7 @@
joydev->corr[i].prec = dev->absfuzz[j];
joydev->corr[i].coef[0] = (dev->absmax[j] + dev->absmin[j]) / 2 - dev->absflat[j];
joydev->corr[i].coef[1] = (dev->absmax[j] + dev->absmin[j]) / 2 + dev->absflat[j];
- if (!(t = ((dev->absmax[j] - dev->absmin[j]) / 2 - 2 * dev->absflat[j]))
+ if (!(t = ((dev->absmax[j] - dev->absmin[j]) / 2 - 2 * dev->absflat[j])))
continue;
joydev->corr[i].coef[2] = (1 << 29) / t;
joydev->corr[i].coef[3] = (1 << 29) / t;
Index: usbkbd.c
===================================================================
RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/input/usbkbd.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- usbkbd.c 2001/09/25 10:12:07 1.26
+++ usbkbd.c 2001/12/27 10:37:41 1.27
@@ -194,9 +194,6 @@
pipe = usb_rcvintpipe(dev, endpoint->bEndpointAddress);
maxp = usb_maxpacket(dev, pipe, usb_pipeout(pipe));
- usb_set_protocol(dev, interface->bInterfaceNumber, 0);
- usb_set_idle(dev, interface->bInterfaceNumber, 0, 0);
-
if (!(kbd = kmalloc(sizeof(struct usb_kbd), GFP_KERNEL))) return NULL;
memset(kbd, 0, sizeof(struct usb_kbd));
@@ -218,7 +215,7 @@
usb_kbd_irq, kbd, endpoint->bInterval);
kbd->dr.requesttype = USB_TYPE_CLASS | USB_RECIP_INTERFACE;
- kbd->dr.request = USB_REQ_SET_REPORT;
+ kbd->dr.request = 0x09;
kbd->dr.value = 0x200;
kbd->dr.index = interface->bInterfaceNumber;
kbd->dr.length = 1;
Index: usbmouse.c
===================================================================
RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/input/usbmouse.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- usbmouse.c 2001/09/25 10:12:07 1.14
+++ usbmouse.c 2001/12/27 10:37:41 1.15
@@ -120,8 +120,6 @@
pipe = usb_rcvintpipe(dev, endpoint->bEndpointAddress);
maxp = usb_maxpacket(dev, pipe, usb_pipeout(pipe));
- usb_set_idle(dev, interface->bInterfaceNumber, 0, 0);
-
if (!(mouse = kmalloc(sizeof(struct usb_mouse), GFP_KERNEL))) return NULL;
memset(mouse, 0, sizeof(struct usb_mouse));
|