Bug #1968
closedukbd patch
Added by masterblaster almost 14 years ago. Updated almost 14 years ago.
0%
Description
Hi all,
as i am new to kernel drivers, i suppose (just looking at usbd_get_quirks() prototype) that the quirk for usb keyboard was set the wrong way.
I don't even know if the quirk is needed at all, as no device is marked with UQ_NO_SET_PROTO ...
Without this patch uhci driver doesn't generate an interrupt when Fn key is pressed on Apple usb keyboard (it took me days to realize this...).
I just want to map Fn key to 'insert' keycode. For that it's than enough to set ukbd_trtab1=102 in ukbd.c ,but i don't know if to hardcode this violates any standard. Does it?
Thanks!
Files
0001-set-usb-quirk-the-right-way.patch (871 Bytes) 0001-set-usb-quirk-the-right-way.patch | masterblaster, 01/25/2011 08:09 AM |
Updated by alexh almost 14 years ago
On 25/01/11 06:29, Magliano Andrea wrote:
Without this patch uhci driver doesn't generate an interrupt when Fn key is pressed on Apple usb keyboard (it took me days to realize this...).
With this patch that code is probably skipped unconditionally in the
normal case.
I just want to map Fn key to 'insert' keycode. For that it's than enough to set ukbd_trtab1=102 in ukbd.c ,but i don't know if to hardcode this violates any standard. Does it?
Why don't you just set the quirk NO_SET_PROTO for that device? That will
have the same effect.
0001-set-usb-quirk-the-right-way.patch
From 639a855e36f1bf7b1d6120ba5c2bd1a871614ead Mon Sep 17 00:00:00 2001
From: Charlie <root@randy.andy.net>
Date: Tue, 25 Jan 2011 06:58:43 +0100
Subject: [PATCH] set usb quirk the right way---
sys/dev/usbmisc/ukbd/ukbd.c | 2), 1 deletions()
1 files changed, 1 insertions(diff --git a/sys/dev/usbmisc/ukbd/ukbd.c b/sys/dev/usbmisc/ukbd/ukbd.c
index 2099921..e3adf78 100644
--- a/sys/dev/usbmisc/ukbd/ukbd.c
+++ b/sys/dev/usbmisc/ukbd/ukbd.c@ -1460,7 +1460,7
@ bLength=%d bDescriptorType=%d bEndpointAddress=%d-%s bmAttributes=%d wMaxPacketS
return EINVAL;
}- if ((usbd_get_quirks(state->ks_uaa->device)->uq_flags & UQ_NO_SET_PROTO) == 0) {
+ if (usbd_get_quirks(state->ks_uaa->device)->uq_flags & UQ_NO_SET_PROTO) {
This makes no sense. The original condition was: "If we are asked not to
set a proto skip this section, otherwise call usbd_set_protocol".
Now it is: "If we are asked not to set a proto, set a proto.".
err = usbd_set_protocol(state->ks_iface, 0);
DPRINTFN);
if (err) {
-- 1.7.3.2
Updated by masterblaster almost 14 years ago
Hallo Alex,
bin btw in chat als randy1 unterwegs.
On 1/25/2011, ""Alex Hornung \(via DragonFly issue tracker\)"
submit@crater.dragonflybsd.org" <"Alex Hornung \(via DragonFly issue
tracker\)"
submit@crater.dragonflybsd.org> wrote:
Alex Hornung <ahornung@gmail.com> added the comment:
On 25/01/11 06:29, Magliano Andrea wrote:
Without this patch uhci driver doesn't generate an interrupt when Fn key is pressed on Apple usb keyboard (it took me days to realize this...).
With this patch that code is probably skipped unconditionally in the
normal case.I just want to map Fn key to 'insert' keycode. For that it's than enough to set ukbd_trtab1=102 in ukbd.c ,but i don't know if to hardcode this violates any standard. Does it?
Why don't you just set the quirk NO_SET_PROTO for that device? That will
have the same effect.0001-set-usb-quirk-the-right-way.patch
From 639a855e36f1bf7b1d6120ba5c2bd1a871614ead Mon Sep 17 00:00:00 2001
From: Charlie <root@randy.andy.net>
Date: Tue, 25 Jan 2011 06:58:43 +0100
Subject: [PATCH] set usb quirk the right way---
sys/dev/usbmisc/ukbd/ukbd.c | 2), 1 deletions()
1 files changed, 1 insertions(diff --git a/sys/dev/usbmisc/ukbd/ukbd.c b/sys/dev/usbmisc/ukbd/ukbd.c
index 2099921..e3adf78 100644
--- a/sys/dev/usbmisc/ukbd/ukbd.c
+++ b/sys/dev/usbmisc/ukbd/ukbd.c@ -1460,7 +1460,7
@ bLength=%d bDescriptorType=%d bEndpointAddress=%d-%s bmAttributes=%d wMaxPacketS
return EINVAL;
}- if ((usbd_get_quirks(state->ks_uaa->device)->uq_flags & UQ_NO_SET_PROTO) == 0) {
+ if (usbd_get_quirks(state->ks_uaa->device)->uq_flags & UQ_NO_SET_PROTO) {This makes no sense. The original condition was: "If we are asked not to
set a proto skip this section, otherwise call usbd_set_protocol".
Das verstehe ich nicht ganz; usbd_get_quirks() bedeutet: wenn es ein
quirk fuer den device gibt, dann...
In der Tat es gibt kein quirk fuer den keyboard, trotzdem setzt der
original code den protocol zu 0.
Aus usb_quirks.h:
#define UQ_NO_SET_PROTO 0x0001 /* cannot handle SET PROTOCOL. */
was bedeuten soll, dass der device den protocol nicht setzen kann, darum
usbd_set_protocol(state->ks_iface, 0) zwingen, was in dem Fall nicht
noetig ist (?)
Now it is: "If we are asked not to set a proto, set a proto.".
err = usbd_set_protocol(state->ks_iface, 0);
DPRINTFN);
if (err) {
-- 1.7.3.2----------
status: unread -> chatting_____________________________________________
DragonFly issue tracker <bugs@lists.dragonflybsd.org>
<http://bugs.dragonflybsd.org/issue1968>
_____________________________________________
Updated by y0n3t4n1 almost 14 years ago
Hi,
On Tue, Jan 25, 2011 at 07:29:10AM +0100, Magliano Andrea wrote:
as i am new to kernel drivers, i suppose (just looking at usbd_get_quirks() prototype) that the quirk for usb keyboard was set the wrong way.
The code as is looks correct to me: set the protocol unless the quirk is set.
Instead, try adding a quirk like below to usb_quirks[] (NOTE: the ids may be
different from yours) and rebuild the usb.ko if kldstat command shows it,
or the kernel if not.
diff --git a/sys/bus/usb/usb_quirks.c b/sys/bus/usb/usb_quirks.c
index 4ef50d3..20573f2 100644
--- a/sys/bus/usb/usb_quirks.c
++ b/sys/bus/usb/usb_quirks.c@ -57,6 +57,9
@ static const struct usbd_quirk_entry {
u_int16_t bcdDevice;
struct usbd_quirks quirks;
} usb_quirks[] = {
/* Apple USB keyboard /
+ { .idVendor = 0x05ac, .idProduct = 0x021d, .bcdDevice = ANY,
+ .quirks = { UQ_NO_SET_PROTO}},
/ KYE Niche mouse */
{ .idVendor = 0x0458, .idProduct = 0x0001, .bcdDevice = 0x100,
.quirks = { UQ_NO_SET_PROTO}},
Cheers.