keyboard driver problem?
Hello, have problem with A4Tech G7100 wireless combo mouse+keyboard. Mouse works fine, but keyboard not. It's loading: ugen4.2: at usbus4 ukbd1: on usbus4 but pressing any key doesn't have effect. It works only in one way - if i pressing one (any) key and don't releasing it and preessing another key at the same time. For example to make work key "a" i should press "b" (and don't releasing it, use like "shift") and after that pressing key "a". And it works. This problem is only in 8.x branch. At Freebsd 7.3, 7.4 it works ok. I think the problem is in new ukbd-driver, when i press 'q' key, debug says: ukbd_intr_callback:547: actlen=8 bytes ukbd_intr_callback:590: apple_eject=0 apple_fn=0 ukbd_intr_callback:597: [0] = 20 ukbd_put_key:312: 0x14 (20) pressed ukbd_intr_callback:547: actlen=8 bytes ukbd_intr_callback:590: apple_eject=0 apple_fn=0 ukbd_put_key:312: 0x414 (1044) released (this is for usb wire-keyboard that works fine) ukbd_intr_callback:547: actlen=12 bytes ukbd_intr_callback:590: apple_eject=0 apple_fn=0 (and this is for my ATech G7100 keyboard) Could you tell me where the problem is? ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
keyboard driver problem?
I've tried already to change both UKBD_NMOD and UKBD_NKEYCODE, but where is no result. #define UKBD_NKEYCODE 8 // doesn't work too > usbconfig -u 4 -a 2 dump_device_desc dump_curr_config_desc ugen4.2: at usbus4, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON bLength = 0x0012 bDescriptorType = 0x0001 bcdUSB = 0x0110 bDeviceClass = 0x bDeviceSubClass = 0x bDeviceProtocol = 0x bMaxPacketSize0 = 0x0008 idVendor = 0x09da idProduct = 0x054f bcdDevice = 0x0102 iManufacturer = 0x0001 iProduct = 0x0002 iSerialNumber = 0x bNumConfigurations = 0x0001 Configuration index 0 bLength = 0x0009 bDescriptorType = 0x0002 wTotalLength = 0x003b bNumInterfaces = 0x0002 bConfigurationValue = 0x0001 iConfiguration = 0x bmAttributes = 0x00a0 bMaxPower = 0x0032 Interface 0 bLength = 0x0009 bDescriptorType = 0x0004 bInterfaceNumber = 0x bAlternateSetting = 0x bNumEndpoints = 0x0001 bInterfaceClass = 0x0003 bInterfaceSubClass = 0x0001 bInterfaceProtocol = 0x0001 iInterface = 0x Additional Descriptor bLength = 0x09 bDescriptorType = 0x21 bDescriptorSubType = 0x11 RAW dump: 0x00 | 0x09, 0x21, 0x11, 0x01, 0x00, 0x01, 0x22, 0x84, 0x08 | 0x00 Endpoint 0 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0081 bmAttributes = 0x0003 wMaxPacketSize = 0x000c bInterval = 0x0001 bRefresh = 0x bSynchAddress = 0x Interface 1 bLength = 0x0009 bDescriptorType = 0x0004 bInterfaceNumber = 0x0001 bAlternateSetting = 0x bNumEndpoints = 0x0001 bInterfaceClass = 0x0003 bInterfaceSubClass = 0x0001 bInterfaceProtocol = 0x0002 iInterface = 0x Additional Descriptor bLength = 0x09 bDescriptorType = 0x21 bDescriptorSubType = 0x11 RAW dump: 0x00 | 0x09, 0x21, 0x11, 0x01, 0x00, 0x01, 0x22, 0x57, 0x08 | 0x00 Endpoint 0 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0082 bmAttributes = 0x0003 wMaxPacketSize = 0x0008 bInterval = 0x0001 bRefresh = 0x bSynchAddress = 0x // sorry if i missed the thread, dunno how to reply via gmail correctly ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
keyboard driver problem?
already tried variants : offset+=4 && len-=4 offset+=0 && len-=4 and yours, but they doesn't have correct effect (yours variant gives some addition lags: for example pressing "o" presses Scroll Lock, "h" - WIN_L and etc) ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
keyboard driver problem?
I met with the same problem. I do not know how to solve this problem: http://lists.freebsd.org/pipermail/freebsd-current/2011-January/022022.html % uname -a FreeBSD td.local 9.0-CURRENT FreeBSD 9.0-CURRENT #3 r223706M: Fri Jul 1 16:50:12 YEKT 2011 root@td.local:/usr/obj/usr/src/sys/TI amd64 % dmesg ugen5.2: at usbus5 ugen6.2: at usbus6 ukbd0: on usbus5 kbd2 at ukbd0 ukbd2: on usbus6 ums0: on usbus5 kbd3 at ukbd2 ums0: 8 buttons and [XYZT] coordinates ID=1 ums1: on usbus6 ums1: 16 buttons and [XYZT] coordinates ID=0 % usbconfig -u 6 -a 2 dump_device_desc dump_curr_config_desc ugen6.2: at usbus6, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON bLength = 0x0012 bDescriptorType = 0x0001 bcdUSB = 0x0110 bDeviceClass = 0x bDeviceSubClass = 0x bDeviceProtocol = 0x bMaxPacketSize0 = 0x0008 idVendor = 0x09da idProduct = 0x054f bcdDevice = 0x0102 iManufacturer = 0x0001 iProduct = 0x0002 iSerialNumber = 0x bNumConfigurations = 0x0001 Configuration index 0 bLength = 0x0009 bDescriptorType = 0x0002 wTotalLength = 0x003b bNumInterfaces = 0x0002 bConfigurationValue = 0x0001 iConfiguration = 0x bmAttributes = 0x00a0 bMaxPower = 0x0032 Interface 0 bLength = 0x0009 bDescriptorType = 0x0004 bInterfaceNumber = 0x bAlternateSetting = 0x bNumEndpoints = 0x0001 bInterfaceClass = 0x0003 bInterfaceSubClass = 0x0001 bInterfaceProtocol = 0x0001 iInterface = 0x Additional Descriptor bLength = 0x09 bDescriptorType = 0x21 bDescriptorSubType = 0x11 RAW dump: 0x00 | 0x09, 0x21, 0x11, 0x01, 0x00, 0x01, 0x22, 0x84, 0x08 | 0x00 Endpoint 0 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0081 bmAttributes = 0x0003 wMaxPacketSize = 0x000c bInterval = 0x0001 bRefresh = 0x bSynchAddress = 0x Interface 1 bLength = 0x0009 bDescriptorType = 0x0004 bInterfaceNumber = 0x0001 bAlternateSetting = 0x bNumEndpoints = 0x0001 bInterfaceClass = 0x0003 bInterfaceSubClass = 0x0001 bInterfaceProtocol = 0x0002 iInterface = 0x Additional Descriptor bLength = 0x09 bDescriptorType = 0x21 bDescriptorSubType = 0x11 RAW dump: 0x00 | 0x09, 0x21, 0x11, 0x01, 0x00, 0x01, 0x22, 0x57, 0x08 | 0x00 Endpoint 0 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0082 bmAttributes = 0x0003 wMaxPacketSize = 0x0008 bInterval = 0x0001 bRefresh = 0x bSynchAddress = 0x -- Not work: #define UKBD_NKEYCODE 8 -- Not work: if (sc->sc_kbd_id != 0) { /* check and remove HID ID byte */ usbd_copy_out(pc, 0, &id, 1); if (id != sc->sc_kbd_id) { DPRINTF("wrong HID ID\n"); goto tr_setup; } offset = 1; len--; } else { offset = 0; } + if (len == 12) { + offset += 2; + len -= 2; + } + if (len == 11) { + offset += 1; + len -= 1; + } ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: keyboard driver problem?
On Sunday 02 January 2011 09:36:06 too.much.du...@gmail.com wrote: > Hello, have problem with A4Tech G7100 wireless combo mouse+keyboard. > Mouse works fine, but keyboard not. It's loading: > ugen4.2: at usbus4 > ukbd1: on usbus4 > but pressing any key doesn't have effect. It works only in one way - if i > pressing one (any) key and don't releasing it and preessing another key at > the same time. > > For example to make work key "a" i should press "b" (and don't releasing > it, use like "shift") and after that pressing key "a". And it works. > > This problem is only in 8.x branch. At Freebsd 7.3, 7.4 it works ok. > I think the problem is in new ukbd-driver, when i press 'q' key, debug > says: > > ukbd_intr_callback:547: actlen=8 bytes > ukbd_intr_callback:590: apple_eject=0 apple_fn=0 > ukbd_intr_callback:597: [0] = 20 > ukbd_put_key:312: 0x14 (20) pressed > ukbd_intr_callback:547: actlen=8 bytes > ukbd_intr_callback:590: apple_eject=0 apple_fn=0 > ukbd_put_key:312: 0x414 (1044) released > (this is for usb wire-keyboard that works fine) > > ukbd_intr_callback:547: actlen=12 bytes > ukbd_intr_callback:590: apple_eject=0 apple_fn=0 > (and this is for my ATech G7100 keyboard) Could you dump the device and configuration descriptors of your keyboard using the usbconfig utility. usbconfig -d X.Y dump_device_desc dump_curr_config_desc It looks like your keyboard is sending 12 bytes instead of 8, which is expected from UKBD. --HPS ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: keyboard driver problem?
On Sunday 02 January 2011 09:36:06 too.much.du...@gmail.com wrote: > Hello, have problem with A4Tech G7100 wireless combo mouse+keyboard. > Mouse works fine, but keyboard not. It's loading: > ugen4.2: at usbus4 > ukbd1: on usbus4 > but pressing any key doesn't have effect. It works only in one way - if i > pressing one (any) key and don't releasing it and preessing another key at > the same time. > > For example to make work key "a" i should press "b" (and don't releasing > it, use like "shift") and after that pressing key "a". And it works. > > This problem is only in 8.x branch. At Freebsd 7.3, 7.4 it works ok. > I think the problem is in new ukbd-driver, when i press 'q' key, debug In sys/dev/usb/input/ukbd.c, you could try to redefine this variable to 8. #define UKBD_NKEYCODE 6 /* units */ --HPS ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: keyboard driver problem?
On Sunday 02 January 2011 15:22:32 I Think wrote: > I've tried already to change both UKBD_NMOD and UKBD_NKEYCODE, but where is > no result. > #define UKBD_NKEYCODE 8 // doesn't work too > > > usbconfig -u 4 -a 2 dump_device_desc dump_curr_config_desc > > ugen4.2: at usbus4, cfg=0 md=HOST spd=FULL (12Mbps) > pwr=ON > > bLength = 0x0012 > bDescriptorType = 0x0001 > bcdUSB = 0x0110 > bDeviceClass = 0x > bDeviceSubClass = 0x > bDeviceProtocol = 0x > bMaxPacketSize0 = 0x0008 > idVendor = 0x09da > idProduct = 0x054f > bcdDevice = 0x0102 > iManufacturer = 0x0001 > iProduct = 0x0002 > iSerialNumber = 0x > bNumConfigurations = 0x0001 > > > Configuration index 0 > > bLength = 0x0009 > bDescriptorType = 0x0002 > wTotalLength = 0x003b > bNumInterfaces = 0x0002 > bConfigurationValue = 0x0001 > iConfiguration = 0x > bmAttributes = 0x00a0 > bMaxPower = 0x0032 > > Interface 0 > bLength = 0x0009 > bDescriptorType = 0x0004 > bInterfaceNumber = 0x > bAlternateSetting = 0x > bNumEndpoints = 0x0001 > bInterfaceClass = 0x0003 > bInterfaceSubClass = 0x0001 > bInterfaceProtocol = 0x0001 > iInterface = 0x > > Additional Descriptor > > bLength = 0x09 > bDescriptorType = 0x21 > bDescriptorSubType = 0x11 >RAW dump: >0x00 | 0x09, 0x21, 0x11, 0x01, 0x00, 0x01, 0x22, 0x84, >0x08 | 0x00 > > Endpoint 0 > bLength = 0x0007 > bDescriptorType = 0x0005 > bEndpointAddress = 0x0081 > bmAttributes = 0x0003 > wMaxPacketSize = 0x000c > bInterval = 0x0001 > bRefresh = 0x > bSynchAddress = 0x > > > Interface 1 > bLength = 0x0009 > bDescriptorType = 0x0004 > bInterfaceNumber = 0x0001 > bAlternateSetting = 0x > bNumEndpoints = 0x0001 > bInterfaceClass = 0x0003 > bInterfaceSubClass = 0x0001 > bInterfaceProtocol = 0x0002 > iInterface = 0x > > Additional Descriptor > > bLength = 0x09 > bDescriptorType = 0x21 > bDescriptorSubType = 0x11 >RAW dump: >0x00 | 0x09, 0x21, 0x11, 0x01, 0x00, 0x01, 0x22, 0x57, >0x08 | 0x00 > > Endpoint 0 > bLength = 0x0007 > bDescriptorType = 0x0005 > bEndpointAddress = 0x0082 > bmAttributes = 0x0003 > wMaxPacketSize = 0x0008 > bInterval = 0x0001 > bRefresh = 0x > bSynchAddress = 0x > > You could maybe try this. Lookup the following code in ukbd.c. Add the lines marked with + if (sc->sc_kbd_id != 0) { /* check and remove HID ID byte */ usbd_copy_out(pc, 0, &id, 1); if (id != sc->sc_kbd_id) { DPRINTF("wrong HID ID\n"); goto tr_setup; } offset = 1; len--; } else { offset = 0; } + if (len == 12) { + offset += 2; + len -= 2; + } + if (len == 11) { + offset += 1; + len -= 1; + } --HPS ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: keyboard driver problem?
On Sunday 02 January 2011 15:42:42 too.much.du...@gmail.com wrote: > already tried variants : > offset+=4 && len-=4 > offset+=0 && len-=4 > and yours, but they doesn't have correct effect > (yours variant gives some addition lags: > for example pressing "o" presses Scroll Lock, "h" - WIN_L and etc) Hi, Maybe you can add a printout, to dump the len bytes: uint32_t yy; printf("UKBD data: "); for (yy = 0; yy != len; yy++) { uint8_t temp; usbd_copy_out(pc, offset + yy, &temp, 1); printf("0x%02x ", (int)temp); } printf("\n"); I guess the reason your keyboard doesn't work is that we don't parse any HID descriptors in UKBD. --HPS ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: keyboard driver problem?
ukbd_intr_callback:547: actlen=12 bytes ukbd_intr_callback:568: UKBD data: ukbd_intr_callback:575: 0x00 ukbd_intr_callback:575: 0x14 ukbd_intr_callback:575: 0x00 ukbd_intr_callback:575: 0x00 ukbd_intr_callback:575: 0x00 ukbd_intr_callback:575: 0x00 ukbd_intr_callback:575: 0x00 ukbd_intr_callback:575: 0x00 ukbd_intr_callback:575: 0x00 ukbd_intr_callback:575: 0x00 ukbd_intr_callback:575: 0x00 ukbd_intr_callback:578: ukbd_intr_callback:603: apple_eject=0 apple_fn=0 i tried debug "sc_odata.keycode[i]" "sc_ndata.keycode[i]" at function "ukbd_interrupt()", they are empty, but for another keyboard they are not. > I guess the reason your keyboard doesn't work is that we don't parse any HID > descriptors in UKBD. So why is it working in freebsd 7.x then? ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: keyboard driver problem?
On Friday 01 July 2011 13:21:35 ti bugmenot wrote: > I met with the same problem. I do not know how to solve this problem: > > http://lists.freebsd.org/pipermail/freebsd-current/2011-January/022022.html > Hi, Our USB keyboard driver is very simple and does not parse the HID descriptors of the keyboard. Maybe that is the reason it is not working. Try to set the "UQ_KBD_BOOTPROTO" for your keyboard. usbconfig -d X.Y add_quirk UQ_KBD_BOOTPROTO Replug keyboard. --HPS ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: keyboard driver problem?
On 1 July 2011 16:05, Hans Petter Selasky wrote: > On Friday 01 July 2011 13:21:35 ti bugmenot wrote: >> I met with the same problem. I do not know how to solve this problem: >> >> http://lists.freebsd.org/pipermail/freebsd-current/2011-January/022022.html >> > > Hi, > > Our USB keyboard driver is very simple and does not parse the HID descriptors > of the keyboard. Maybe that is the reason it is not working. > > > Try to set the "UQ_KBD_BOOTPROTO" for your keyboard. > > usbconfig -d X.Y add_quirk UQ_KBD_BOOTPROTO > > Replug keyboard. > I have same with MS USB keyboard (only numlock, capslock are working). r221858 doesn't have this bug(?) -- Eir Nym > --HPS > ___ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org" > ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: keyboard driver problem?
On Friday 01 July 2011 16:14:43 Eir Nym wrote: > On 1 July 2011 16:05, Hans Petter Selasky wrote: > > On Friday 01 July 2011 13:21:35 ti bugmenot wrote: > >> I met with the same problem. I do not know how to solve this problem: > >> > >> http://lists.freebsd.org/pipermail/freebsd-current/2011-January/022022.h > >> tml > > > > Hi, > > > > Our USB keyboard driver is very simple and does not parse the HID > > descriptors of the keyboard. Maybe that is the reason it is not working. > > > > > > Try to set the "UQ_KBD_BOOTPROTO" for your keyboard. > > > > usbconfig -d X.Y add_quirk UQ_KBD_BOOTPROTO > > > > Replug keyboard. > > I have same with MS USB keyboard (only numlock, capslock are working). > r221858 doesn't have this bug(?) What happens if you unload ums ? Maybe there is a driver conflict? --HPS ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: keyboard driver problem?
On Friday 01 July 2011 16:14:43 Eir Nym wrote: > On 1 July 2011 16:05, Hans Petter Selasky wrote: > > On Friday 01 July 2011 13:21:35 ti bugmenot wrote: > >> I met with the same problem. I do not know how to solve this problem: > >> > >> http://lists.freebsd.org/pipermail/freebsd-current/2011-January/022022.h > >> tml > > > > Hi, > > > > Our USB keyboard driver is very simple and does not parse the HID > > descriptors of the keyboard. Maybe that is the reason it is not working. > > > > > > Try to set the "UQ_KBD_BOOTPROTO" for your keyboard. > > > > usbconfig -d X.Y add_quirk UQ_KBD_BOOTPROTO > > > > Replug keyboard. > > I have same with MS USB keyboard (only numlock, capslock are working). > r221858 doesn't have this bug(?) > Try to dump the HID descriptor of your device: usbconfig -d X.Y do_request 0x81 0x06 0x2200 0 0x100 That might be helpful. --HPS ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: keyboard driver problem?
Hi, Can you try the attached patch and report back? Please also send me your HID descriptor: usbconfig -d X.Y do_request 0x81 0x06 0x2200 0 0x100 --HPS === input/ukbd.c == --- input/ukbd.c (revision 223581) +++ input/ukbd.c (local) @@ -108,9 +108,10 @@ #define UKBD_IN_BUF_SIZE (2*(UKBD_NMOD + (2*UKBD_NKEYCODE))) /* bytes */ #define UKBD_IN_BUF_FULL (UKBD_IN_BUF_SIZE / 2) /* bytes */ #define UKBD_NFKEY(sizeof(fkey_tab)/sizeof(fkey_tab[0])) /* units */ +#define UKBD_OUT_BUF_SIZE 16 /* bytes */ struct ukbd_data { - uint8_t modifiers; + uint16_t modifiers; #define MOD_CONTROL_L 0x01 #define MOD_CONTROL_R 0x10 #define MOD_SHIFT_L 0x02 @@ -119,9 +120,10 @@ #define MOD_ALT_R 0x40 #define MOD_WIN_L 0x08 #define MOD_WIN_R 0x80 - uint8_t reserved; +/* internal */ +#define MOD_EJECT 0x0100 +#define MOD_FN 0x0200 uint8_t keycode[UKBD_NKEYCODE]; - uint8_t exten[8]; }; enum { @@ -137,6 +139,18 @@ fkeytab_t sc_fkeymap[UKBD_NFKEY]; struct hid_location sc_loc_apple_eject; struct hid_location sc_loc_apple_fn; + struct hid_location sc_loc_ctrl_l; + struct hid_location sc_loc_ctrl_r; + struct hid_location sc_loc_shift_l; + struct hid_location sc_loc_shift_r; + struct hid_location sc_loc_alt_l; + struct hid_location sc_loc_alt_r; + struct hid_location sc_loc_win_l; + struct hid_location sc_loc_win_r; + struct hid_location sc_loc_events; + struct hid_location sc_loc_numlock; + struct hid_location sc_loc_capslock; + struct hid_location sc_loc_scrolllock; struct usb_callout sc_callout; struct ukbd_data sc_ndata; struct ukbd_data sc_odata; @@ -155,30 +169,60 @@ uint32_t sc_buffered_char[2]; #endif uint32_t sc_flags; /* flags */ -#define UKBD_FLAG_COMPOSE 0x0001 -#define UKBD_FLAG_POLLING 0x0002 -#define UKBD_FLAG_SET_LEDS 0x0004 -#define UKBD_FLAG_ATTACHED 0x0010 -#define UKBD_FLAG_GONE 0x0020 -#define UKBD_FLAG_APPLE_EJECT 0x0040 -#define UKBD_FLAG_APPLE_FN 0x0080 -#define UKBD_FLAG_APPLE_SWAP 0x0100 -#define UKBD_FLAG_TIMER_RUNNING 0x0200 +#define UKBD_FLAG_COMPOSE 0x0001 +#define UKBD_FLAG_POLLING 0x0002 +#define UKBD_FLAG_SET_LEDS 0x0004 +#define UKBD_FLAG_ATTACHED 0x0010 +#define UKBD_FLAG_GONE 0x0020 +#define UKBD_FLAG_APPLE_EJECT 0x0040 +#define UKBD_FLAG_APPLE_FN 0x0080 +#define UKBD_FLAG_APPLE_SWAP 0x0100 +#define UKBD_FLAG_TIMER_RUNNING 0x0200 +#define UKBD_FLAG_CTRL_L 0x0400 +#define UKBD_FLAG_CTRL_R 0x0800 +#define UKBD_FLAG_SHIFT_L 0x1000 +#define UKBD_FLAG_SHIFT_R 0x2000 +#define UKBD_FLAG_ALT_L 0x4000 +#define UKBD_FLAG_ALT_R 0x8000 +#define UKBD_FLAG_WIN_L 0x0001 +#define UKBD_FLAG_WIN_R 0x0002 +#define UKBD_FLAG_EVENTS 0x0004 +#define UKBD_FLAG_NUMLOCK 0x0008 +#define UKBD_FLAG_CAPSLOCK 0x0010 +#define UKBD_FLAG_SCROLLLOCK 0x0020 int sc_mode; /* input mode (K_XLATE,K_RAW,K_CODE) */ int sc_state; /* shift/lock key state */ int sc_accents; /* accent key index (> 0) */ int sc_poll_tick_last; + int sc_led_size; + int sc_kbd_size; uint16_t sc_inputs; uint16_t sc_inputhead; uint16_t sc_inputtail; + uint16_t sc_modifiers; uint8_t sc_leds; /* store for async led requests */ uint8_t sc_iface_index; uint8_t sc_iface_no; + uint8_t sc_id_apple_eject; + uint8_t sc_id_apple_fn; + uint8_t sc_id_ctrl_l; + uint8_t sc_id_ctrl_r; + uint8_t sc_id_shift_l; + uint8_t sc_id_shift_r; + uint8_t sc_id_alt_l; + uint8_t sc_id_alt_r; + uint8_t sc_id_win_l; + uint8_t sc_id_win_r; + uint8_t sc_id_event; + uint8_t sc_id_numlock; + uint8_t sc_id_capslock; + uint8_t sc_id_scrolllock; + uint8_t sc_id_events; uint8_t sc_kbd_id; - uint8_t sc_led_id; + uint8_t sc_poll_detected; }; @@ -558,11 +602,10 @@ { struct ukbd_softc *sc = usbd_xfer_softc(xfer); struct usb_page_cache *pc; + uint8_t buffer[32]; uint8_t i; uint8_t offset; uint8_t id; - uint8_t apple_fn; - uint8_t apple_eject; int len; usbd_xfer_status(xfer, &len, NULL, NULL, NULL); @@ -586,67 +629,142 @@ } offset = 1; len--; + if (len == 0) { +DPRINTF("zero length data\n"); +goto tr_setup; + } } else { offset = 0; } - if (len > sizeof(sc->sc_ndata)) { - len = sizeof(sc->sc_ndata); - } + if (len > sizeof(buffer)) + len = sizeof(buffer); - if (len) { - memset(&sc->sc_ndata, 0, sizeof(sc->sc_ndata)); - usbd_copy_out(pc, offset, &sc->sc_ndata, len); + /* get data */ + usbd_copy_out(pc, offset, buffer, len); - if ((sc->sc_flags & UKBD_FLAG_APPLE_EJECT) && - hid_get_data((uint8_t *)&sc->sc_ndata, -len, &sc->sc_loc_apple_eject)) -apple_eject = 1; - else -apple_eject = 0; + /* clear temporary storage */ + memset(&sc->sc_ndata, 0, sizeof(sc->sc_ndata)); - if ((sc->sc_flags & UKBD_FLAG_APPLE_FN) && - hid_get_data((uint8_t *)&sc->sc_ndata, -len, &sc->sc_loc_apple_fn)) -apple_fn = 1; + /* scan through HID data */ + if ((sc->sc_flags & UKBD_FLAG_APPLE_EJE
Re: keyboard driver problem?
Hi, I've committed a larger patch to UKBD to make it more HID compliant. Please try the following patch and report back if you see any regression issues with your USB keyboard. http://svn.freebsd.org/changeset/base/223755 --HPS ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: keyboard driver problem?
works well ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: keyboard driver problem? (new patch)
Hi, Found some bugs in my intial patch. Try this new one. --HPS === ukbd.c == --- ukbd.c (revision 223581) +++ ukbd.c (local) @@ -108,9 +108,10 @@ #define UKBD_IN_BUF_SIZE (2*(UKBD_NMOD + (2*UKBD_NKEYCODE))) /* bytes */ #define UKBD_IN_BUF_FULL (UKBD_IN_BUF_SIZE / 2) /* bytes */ #define UKBD_NFKEY(sizeof(fkey_tab)/sizeof(fkey_tab[0])) /* units */ +#define UKBD_OUT_BUF_SIZE 16 /* bytes */ struct ukbd_data { - uint8_t modifiers; + uint16_t modifiers; #define MOD_CONTROL_L 0x01 #define MOD_CONTROL_R 0x10 #define MOD_SHIFT_L 0x02 @@ -119,9 +120,10 @@ #define MOD_ALT_R 0x40 #define MOD_WIN_L 0x08 #define MOD_WIN_R 0x80 - uint8_t reserved; +/* internal */ +#define MOD_EJECT 0x0100 +#define MOD_FN 0x0200 uint8_t keycode[UKBD_NKEYCODE]; - uint8_t exten[8]; }; enum { @@ -137,6 +139,18 @@ fkeytab_t sc_fkeymap[UKBD_NFKEY]; struct hid_location sc_loc_apple_eject; struct hid_location sc_loc_apple_fn; + struct hid_location sc_loc_ctrl_l; + struct hid_location sc_loc_ctrl_r; + struct hid_location sc_loc_shift_l; + struct hid_location sc_loc_shift_r; + struct hid_location sc_loc_alt_l; + struct hid_location sc_loc_alt_r; + struct hid_location sc_loc_win_l; + struct hid_location sc_loc_win_r; + struct hid_location sc_loc_events; + struct hid_location sc_loc_numlock; + struct hid_location sc_loc_capslock; + struct hid_location sc_loc_scrolllock; struct usb_callout sc_callout; struct ukbd_data sc_ndata; struct ukbd_data sc_odata; @@ -155,30 +169,60 @@ uint32_t sc_buffered_char[2]; #endif uint32_t sc_flags; /* flags */ -#define UKBD_FLAG_COMPOSE 0x0001 -#define UKBD_FLAG_POLLING 0x0002 -#define UKBD_FLAG_SET_LEDS 0x0004 -#define UKBD_FLAG_ATTACHED 0x0010 -#define UKBD_FLAG_GONE 0x0020 -#define UKBD_FLAG_APPLE_EJECT 0x0040 -#define UKBD_FLAG_APPLE_FN 0x0080 -#define UKBD_FLAG_APPLE_SWAP 0x0100 -#define UKBD_FLAG_TIMER_RUNNING 0x0200 +#define UKBD_FLAG_COMPOSE 0x0001 +#define UKBD_FLAG_POLLING 0x0002 +#define UKBD_FLAG_SET_LEDS 0x0004 +#define UKBD_FLAG_ATTACHED 0x0010 +#define UKBD_FLAG_GONE 0x0020 +#define UKBD_FLAG_APPLE_EJECT 0x0040 +#define UKBD_FLAG_APPLE_FN 0x0080 +#define UKBD_FLAG_APPLE_SWAP 0x0100 +#define UKBD_FLAG_TIMER_RUNNING 0x0200 +#define UKBD_FLAG_CTRL_L 0x0400 +#define UKBD_FLAG_CTRL_R 0x0800 +#define UKBD_FLAG_SHIFT_L 0x1000 +#define UKBD_FLAG_SHIFT_R 0x2000 +#define UKBD_FLAG_ALT_L 0x4000 +#define UKBD_FLAG_ALT_R 0x8000 +#define UKBD_FLAG_WIN_L 0x0001 +#define UKBD_FLAG_WIN_R 0x0002 +#define UKBD_FLAG_EVENTS 0x0004 +#define UKBD_FLAG_NUMLOCK 0x0008 +#define UKBD_FLAG_CAPSLOCK 0x0010 +#define UKBD_FLAG_SCROLLLOCK 0x0020 int sc_mode; /* input mode (K_XLATE,K_RAW,K_CODE) */ int sc_state; /* shift/lock key state */ int sc_accents; /* accent key index (> 0) */ int sc_poll_tick_last; + int sc_led_size; + int sc_kbd_size; uint16_t sc_inputs; uint16_t sc_inputhead; uint16_t sc_inputtail; + uint16_t sc_modifiers; uint8_t sc_leds; /* store for async led requests */ uint8_t sc_iface_index; uint8_t sc_iface_no; + uint8_t sc_id_apple_eject; + uint8_t sc_id_apple_fn; + uint8_t sc_id_ctrl_l; + uint8_t sc_id_ctrl_r; + uint8_t sc_id_shift_l; + uint8_t sc_id_shift_r; + uint8_t sc_id_alt_l; + uint8_t sc_id_alt_r; + uint8_t sc_id_win_l; + uint8_t sc_id_win_r; + uint8_t sc_id_event; + uint8_t sc_id_numlock; + uint8_t sc_id_capslock; + uint8_t sc_id_scrolllock; + uint8_t sc_id_events; uint8_t sc_kbd_id; - uint8_t sc_led_id; + uint8_t sc_poll_detected; }; @@ -558,11 +602,10 @@ { struct ukbd_softc *sc = usbd_xfer_softc(xfer); struct usb_page_cache *pc; + uint8_t buffer[32]; uint8_t i; uint8_t offset; uint8_t id; - uint8_t apple_fn; - uint8_t apple_eject; int len; usbd_xfer_status(xfer, &len, NULL, NULL, NULL); @@ -580,73 +623,145 @@ if (sc->sc_kbd_id != 0) { /* check and remove HID ID byte */ usbd_copy_out(pc, 0, &id, 1); - if (id != sc->sc_kbd_id) { -DPRINTF("wrong HID ID\n"); + offset = 1; + len--; + if (len == 0) { +DPRINTF("zero length data\n"); goto tr_setup; } - offset = 1; - len--; } else { offset = 0; + id = 0; } - if (len > sizeof(sc->sc_ndata)) { - len = sizeof(sc->sc_ndata); - } + if (len > sizeof(buffer)) + len = sizeof(buffer); - if (len) { - memset(&sc->sc_ndata, 0, sizeof(sc->sc_ndata)); - usbd_copy_out(pc, offset, &sc->sc_ndata, len); + /* get data */ + usbd_copy_out(pc, offset, buffer, len); - if ((sc->sc_flags & UKBD_FLAG_APPLE_EJECT) && - hid_get_data((uint8_t *)&sc->sc_ndata, -len, &sc->sc_loc_apple_eject)) -apple_eject = 1; - else -apple_eject = 0; + /* clear temporary storage */ + memset(&sc->sc_ndata, 0, sizeof(sc->sc_ndata)); - if ((sc->sc_flags & UKBD_FLAG_APPLE_FN) && - hid_get_data((uint8_t *)&sc->sc_ndata, -len, &sc->sc_loc_apple_fn)) -