* [PATCH 2.6.11.7 1/2] USB HID: Patch for Cherry CyMotion Linux keyboard
@ 2005-04-18 16:41 Andy Armstrong
2005-04-18 16:45 ` [PATCH 2.6.11.7 2/2] " Andy Armstrong
2005-04-18 18:14 ` [PATCH 2.6.11.7 1/2] " Greg KH
0 siblings, 2 replies; 5+ messages in thread
From: Andy Armstrong @ 2005-04-18 16:41 UTC (permalink / raw)
To: linux-kernel
For those who haven't seen it the Cherry CyMotion Linux keyboard is a
decent quality keyboard with the Windows specific keys replaced with
Linux keys. It's got a nice little picture of Tux on it too. The
supplied patches aren't suitable for current kernels so I've bashed
their patches into a suitable form.
The special case in hid_get_class_descriptor() (which necessitated
moving that function after the #defines for vendor and device ID) is
lifted directly from the code Cherry supply. I'm not certain that's the
best place for it but I don't know the USB HID architecture well enough
to know what else to do with it. Suggestions welcome.
diff -ur linux-2.6.11.7.orig/drivers/usb/input/hid-core.c
linux/drivers/usb/input/hid-core.c
--- linux-2.6.11.7.orig/drivers/usb/input/hid-core.c 2005-04-07
19:57:43.000000000 +0100
+++ linux/drivers/usb/input/hid-core.c 2005-04-18 13:34:59.000000000
+0100
@@ -1291,22 +1291,6 @@
return 0;
}
-static int hid_get_class_descriptor(struct usb_device *dev, int ifnum,
- unsigned char type, void *buf, int size)
-{
- int result, retries = 4;
-
- memset(buf,0,size); // Make sure we parse really received data
-
- do {
- result = 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);
- retries--;
- } while (result < size && retries);
- return result;
-}
-
int hid_open(struct hid_device *hid)
{
if (hid->open++)
@@ -1494,6 +1478,9 @@
#define USB_VENDOR_ID_DELORME 0x1163
#define USB_DEVICE_ID_DELORME_EARTHMATE 0x0100
+#define USB_VENDOR_ID_CHERRY 0x046a
+#define USB_DEVICE_ID_CHERRY_CYMOTION 0x0023
+
static struct hid_blacklist {
__u16 idVendor;
__u16 idProduct;
@@ -1589,6 +1576,37 @@
{ 0, 0 }
};
+static int hid_get_class_descriptor(struct usb_device *dev, int ifnum,
+ unsigned char type, void *buf, int size)
+{
+ int result, retries = 4;
+ char *p = (char*)buf;
+
+ memset(buf,0,size); // Make sure we parse really received data
+
+ do {
+ result = 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);
+ retries--;
+ } while (result < size && retries);
+
+ // wn_hack: patch wrong descriptor for this device
+ // hardware sends wrong descriptor
+ // AA, 20050418: should this test be skipped altogether if
result < size?
+ if (dev->descriptor.idVendor == USB_VENDOR_ID_CHERRY
+ && dev->descriptor.idProduct ==
USB_DEVICE_ID_CHERRY_CYMOTION
+ && result > 12
+ && p[11] == 0x3c
+ && p[12] == 0x02) {
+ printk(KERN_DEBUG __FILE__ " : modifying descriptor for
Cherry CyMotion keyboard \n");
+ p[11] = p[16] = 0xff;
+ p[12] = p[17] = 0x03;
+ }
+
+ return result;
+}
+
static int hid_alloc_buffers(struct usb_device *dev, struct hid_device
*hid)
{
if (!(hid->inbuf = usb_buffer_alloc(dev, HID_BUFFER_SIZE,
SLAB_ATOMIC, &hid->inbuf_dma)))
--
Andy Armstrong, hexten.net
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2.6.11.7 2/2] USB HID: Patch for Cherry CyMotion Linux keyboard
2005-04-18 16:41 [PATCH 2.6.11.7 1/2] USB HID: Patch for Cherry CyMotion Linux keyboard Andy Armstrong
@ 2005-04-18 16:45 ` Andy Armstrong
2005-04-18 18:14 ` [PATCH 2.6.11.7 1/2] " Greg KH
1 sibling, 0 replies; 5+ messages in thread
From: Andy Armstrong @ 2005-04-18 16:45 UTC (permalink / raw)
To: Andy Armstrong; +Cc: linux-kernel
And here are the changes to support the extra keys...
diff -ur linux-2.6.11.7.orig/drivers/usb/input/hid-input.c
linux/drivers/usb/input/hid-input.c
--- linux-2.6.11.7.orig/drivers/usb/input/hid-input.c 2005-04-07
19:57:34.000000000 +0100
+++ linux/drivers/usb/input/hid-input.c 2005-04-18 13:36:16.000000000
+0100
@@ -270,6 +270,12 @@
case 0x227: map_key_clear(KEY_REFRESH); break;
case 0x22a: map_key_clear(KEY_BOOKMARKS); break;
case 0x238: map_rel(REL_HWHEEL); break;
+ case 0x233:
map_key_clear(KEY_SCROLLUP); break;
+ case 0x234:
map_key_clear(KEY_SCROLLDOWN); break;
+ case 0x301: map_key_clear(KEY_PROG1);
break;
+ case 0x302: map_key_clear(KEY_PROG2);
break;
+ case 0x303: map_key_clear(KEY_PROG3);
break;
+ case 0x279: map_key_clear(KEY_AGAIN);
break;
default: goto unknown;
}
break;
--
Andy Armstrong, hexten.net
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2.6.11.7 1/2] USB HID: Patch for Cherry CyMotion Linux keyboard
2005-04-18 16:41 [PATCH 2.6.11.7 1/2] USB HID: Patch for Cherry CyMotion Linux keyboard Andy Armstrong
2005-04-18 16:45 ` [PATCH 2.6.11.7 2/2] " Andy Armstrong
@ 2005-04-18 18:14 ` Greg KH
2005-04-18 20:08 ` Andy Armstrong
2005-04-18 21:11 ` Andy Armstrong
1 sibling, 2 replies; 5+ messages in thread
From: Greg KH @ 2005-04-18 18:14 UTC (permalink / raw)
To: Andy Armstrong; +Cc: linux-kernel
On Mon, Apr 18, 2005 at 05:41:46PM +0100, Andy Armstrong wrote:
> For those who haven't seen it the Cherry CyMotion Linux keyboard is a
> decent quality keyboard with the Windows specific keys replaced with
> Linux keys. It's got a nice little picture of Tux on it too. The
> supplied patches aren't suitable for current kernels so I've bashed
> their patches into a suitable form.
Your patches are line-wrapped, and the tabs were stripped out :(
Care to redo them, add a signed-off-by: line and send them to the
linux-usb-devel mailing list and CC: the hid maintainer?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2.6.11.7 1/2] USB HID: Patch for Cherry CyMotion Linux keyboard
2005-04-18 18:14 ` [PATCH 2.6.11.7 1/2] " Greg KH
@ 2005-04-18 20:08 ` Andy Armstrong
2005-04-18 21:11 ` Andy Armstrong
1 sibling, 0 replies; 5+ messages in thread
From: Andy Armstrong @ 2005-04-18 20:08 UTC (permalink / raw)
To: Greg KH; +Cc: linux-kernel
On 18 Apr 2005, at 19:14, Greg KH wrote:
> Your patches are line-wrapped, and the tabs were stripped out :(
Ah poop - sorry about that. I'm using the Mac mail client which managed
to give me the impression it was going to send them clean.
> Care to redo them, add a signed-off-by: line and send them to the
> linux-usb-devel mailing list and CC: the hid maintainer?
Yes, shall do, thanks.
--
Andy Armstrong, hexten.net
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2.6.11.7 1/2] USB HID: Patch for Cherry CyMotion Linux keyboard
2005-04-18 18:14 ` [PATCH 2.6.11.7 1/2] " Greg KH
2005-04-18 20:08 ` Andy Armstrong
@ 2005-04-18 21:11 ` Andy Armstrong
1 sibling, 0 replies; 5+ messages in thread
From: Andy Armstrong @ 2005-04-18 21:11 UTC (permalink / raw)
To: linux-kernel
On 18 Apr 2005, at 19:14, Greg KH wrote:
> Care to redo them, add a signed-off-by: line and send them to the
> linux-usb-devel mailing list and CC: the hid maintainer?
All done. Sorry for the inconvenience.
--
Andy Armstrong, hexten.net
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-04-18 21:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-18 16:41 [PATCH 2.6.11.7 1/2] USB HID: Patch for Cherry CyMotion Linux keyboard Andy Armstrong
2005-04-18 16:45 ` [PATCH 2.6.11.7 2/2] " Andy Armstrong
2005-04-18 18:14 ` [PATCH 2.6.11.7 1/2] " Greg KH
2005-04-18 20:08 ` Andy Armstrong
2005-04-18 21:11 ` Andy Armstrong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox