2011-04-26 15:47:08

by Valdis Klētnieks

[permalink] [raw]
Subject: Wonkiness with keyboard adapter - not sure if it's in USB or input systems

Running 2.6.39-rc1-mmotm at the moment on a Dell Latitude E6500, that wants an
external USB keyboard/mouse and monitor when it's in its docking station in the
office. I have an old Microsoft Natural keyboard that has a PS/2 connector, but
I like the tactile feel so I didn't want to get rid of it. So we recently got
some PS2->USB adapters, which appear in lsusb as follows:

Bus 001 Device 006: ID 0e8f:0020 GreenAsia Inc. USB to PS/2 Adapter

Now, when I first power up the laptop in the docking station, it *does* see the
keyboard just fine, and Grub is able to talk to it, and everything works (this
particular boot, I was able to hit the space bar to get to the Grub menu, use
arrow up/down to move between entries, all looked good). So it isn't like the
device needs any initialization above and beyond what the BIOS is doing at
initial power-on.

However, when the Linux kernel starts up, it sees the adapter, but doesn't
recognize key presses until I disconnect and then reconnect the keyboard:

[ 5.733323] usb 1-4.2: new low speed USB device number 6 using ehci_hcd
[ 5.827679] usb 1-4.2: New USB device found, idVendor=0e8f, idProduct=0020
[ 5.827692] usb 1-4.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 5.827701] usb 1-4.2: Product: PS2toUSB Adapter
[ 5.827708] usb 1-4.2: Manufacturer: GASIA
[ 5.846069] input: GASIA PS2toUSB Adapter as /devices/pci0000:00/0000:00:1a.7/usb1/1-4/1-4.2/1-4.2:1.0/input/input12
[ 5.847894] generic-usb 0003:0E8F:0020.0002: input,hidraw1: USB HID v1.10 Keyboard [GASIA PS2toUSB Adapter] on usb-0000:00:1a.7-4.2/input0
[ 5.855346] input: GASIA PS2toUSB Adapter as /devices/pci0000:00/0000:00:1a.7/usb1/1-4/1-4.2/1-4.2:1.1/input/input13
[ 5.857351] generic-usb 0003:0E8F:0020.0003: input,hidraw2: USB HID v1.10 Mouse [GASIA PS2toUSB Adapter] on usb-0000:00:1a.7-4.2/input1
[ 134.879149] dracut: Scanning devices dm-0 for LVM volume groups

root VG is LUKS-encrypted, so the initrd waits till the passphrase is entered.
That didn't work at 6-8 seconds in when I got the prompt - type keys, no
response from dracut. I gave it some time, then about 2 mins after boot I
disconnected and reconnected the keyboard's PS2 connector from the adapter, and
then it worked fine, and I was able to enter the passphrase and dracut was
happy.

Not sure what to make of the fact that it registers the input devices right
off, but I see nothing in the dmesg output that the keyboard was unplugged/
replugged.

I have zero evidence that this device ever worked, as I only got it a few days
ago and haven't had a chance to try anything older than 39-rc.

Any idea/suggestions?

Oh, and the output of 'lsusb -v', here for tl;dr reasons:

Bus 001 Device 006: ID 0e8f:0020 GreenAsia Inc. USB to PS/2 Adapter
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x0e8f GreenAsia Inc.
idProduct 0x0020 USB to PS/2 Adapter
bcdDevice 2.80
iManufacturer 1 GASIA
iProduct 2 PS2toUSB Adapter
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 59
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 500mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 1 Boot Interface Subclass
bInterfaceProtocol 1 Keyboard
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.10
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 62
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 8
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 1 Boot Interface Subclass
bInterfaceProtocol 2 Mouse

iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.10
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 130
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0005 1x 5 bytes
bInterval 8
Device Status: 0x0000
(Bus Powered)


Attachments:
(No filename) (227.00 B)

2011-04-26 18:55:59

by Alan Stern

[permalink] [raw]
Subject: Re: Wonkiness with keyboard adapter - not sure if it's in USB or input systems

On Tue, 26 Apr 2011 [email protected] wrote:

> Running 2.6.39-rc1-mmotm at the moment on a Dell Latitude E6500, that wants an
> external USB keyboard/mouse and monitor when it's in its docking station in the
> office. I have an old Microsoft Natural keyboard that has a PS/2 connector, but
> I like the tactile feel so I didn't want to get rid of it. So we recently got
> some PS2->USB adapters, which appear in lsusb as follows:
>
> Bus 001 Device 006: ID 0e8f:0020 GreenAsia Inc. USB to PS/2 Adapter
>
> Now, when I first power up the laptop in the docking station, it *does* see the
> keyboard just fine, and Grub is able to talk to it, and everything works (this
> particular boot, I was able to hit the space bar to get to the Grub menu, use
> arrow up/down to move between entries, all looked good). So it isn't like the
> device needs any initialization above and beyond what the BIOS is doing at
> initial power-on.
>
> However, when the Linux kernel starts up, it sees the adapter, but doesn't
> recognize key presses until I disconnect and then reconnect the keyboard:
>
> [ 5.733323] usb 1-4.2: new low speed USB device number 6 using ehci_hcd
> [ 5.827679] usb 1-4.2: New USB device found, idVendor=0e8f, idProduct=0020
> [ 5.827692] usb 1-4.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
> [ 5.827701] usb 1-4.2: Product: PS2toUSB Adapter
> [ 5.827708] usb 1-4.2: Manufacturer: GASIA
> [ 5.846069] input: GASIA PS2toUSB Adapter as /devices/pci0000:00/0000:00:1a.7/usb1/1-4/1-4.2/1-4.2:1.0/input/input12
> [ 5.847894] generic-usb 0003:0E8F:0020.0002: input,hidraw1: USB HID v1.10 Keyboard [GASIA PS2toUSB Adapter] on usb-0000:00:1a.7-4.2/input0
> [ 5.855346] input: GASIA PS2toUSB Adapter as /devices/pci0000:00/0000:00:1a.7/usb1/1-4/1-4.2/1-4.2:1.1/input/input13
> [ 5.857351] generic-usb 0003:0E8F:0020.0003: input,hidraw2: USB HID v1.10 Mouse [GASIA PS2toUSB Adapter] on usb-0000:00:1a.7-4.2/input1
> [ 134.879149] dracut: Scanning devices dm-0 for LVM volume groups
>
> root VG is LUKS-encrypted, so the initrd waits till the passphrase is entered.
> That didn't work at 6-8 seconds in when I got the prompt - type keys, no
> response from dracut. I gave it some time, then about 2 mins after boot I
> disconnected and reconnected the keyboard's PS2 connector from the adapter, and
> then it worked fine, and I was able to enter the passphrase and dracut was
> happy.
>
> Not sure what to make of the fact that it registers the input devices right
> off, but I see nothing in the dmesg output that the keyboard was unplugged/
> replugged.
>
> I have zero evidence that this device ever worked, as I only got it a few days
> ago and haven't had a chance to try anything older than 39-rc.
>
> Any idea/suggestions?

Have you tried testing the adapter by plugging it in after the system
is running?

Testing in an initrd environment is rather difficult...

Alan Stern

2011-04-26 19:12:35

by Valdis Klētnieks

[permalink] [raw]
Subject: Re: Wonkiness with keyboard adapter - not sure if it's in USB or input systems

On Tue, 26 Apr 2011 14:55:57 EDT, Alan Stern said:
> On Tue, 26 Apr 2011 [email protected] wrote:

> > Bus 001 Device 006: ID 0e8f:0020 GreenAsia Inc. USB to PS/2 Adapter

> Have you tried testing the adapter by plugging it in after the system
> is running?

It works fine at the Grub screen.

It *doesn't* work for the kernel when it initially starts up, even though a few
seconds ago the hardware worked just fine.

It *does* work after I've unplugged/replugged it - I've tested both the USB
side and the PS2 side, in either case it starts working.

I'm not sure what difference "plug it in after it's running" and "unplug/
replug" will have. I suppose I could test that, but I'm suspecting the results
will be "it works fine after plugging it in once the kernel is up".


Attachments:
(No filename) (227.00 B)

2011-04-26 21:29:47

by Jiri Kosina

[permalink] [raw]
Subject: Re: Wonkiness with keyboard adapter - not sure if it's in USB or input systems

On Tue, 26 Apr 2011, [email protected] wrote:

> > > Bus 001 Device 006: ID 0e8f:0020 GreenAsia Inc. USB to PS/2 Adapter
>
> > Have you tried testing the adapter by plugging it in after the system
> > is running?
>
> It works fine at the Grub screen.
>
> It *doesn't* work for the kernel when it initially starts up, even though a few
> seconds ago the hardware worked just fine.
>
> It *does* work after I've unplugged/replugged it - I've tested both the USB
> side and the PS2 side, in either case it starts working.
>
> I'm not sure what difference "plug it in after it's running" and "unplug/
> replug" will have. I suppose I could test that, but I'm suspecting the results
> will be "it works fine after plugging it in once the kernel is up".

It seems like the BIOS handover of the USB input device doesn't work
properly.

The way things usually work in such situations -- BIOS is able to
understand USB input devices in a very basic mode (hidp) and translate the
events into PS/2-looking events, so that things like grub (which don't
understand USB HID) are able to see keyboard events -- BIOS presents those
as PS/2 devices.

Once kernel is booted, it takes over devices in this 'legacy' mode from
BIOS, and initializes them properly as USB input devices.

Seems like this process is broken on your system. Could you please try to
disable legacy USB emulation in your BIOS, and see if the problem
persists? (it will make USB keyboard unavailable in grub).

--
Jiri Kosina
SUSE Labs, Novell Inc.

2011-04-27 00:18:11

by Valdis Klētnieks

[permalink] [raw]
Subject: Re: Wonkiness with keyboard adapter - not sure if it's in USB or input systems

On Tue, 26 Apr 2011 23:29:42 +0200, Jiri Kosina said:
> On Tue, 26 Apr 2011, [email protected] wrote:
>
> > > > Bus 001 Device 006: ID 0e8f:0020 GreenAsia Inc. USB to PS/2 Adapter
> >
> > > Have you tried testing the adapter by plugging it in after the system
> > > is running?
> >
> > It works fine at the Grub screen.
> >
> > It *doesn't* work for the kernel when it initially starts up, even though a few
> > seconds ago the hardware worked just fine.
> >
> > It *does* work after I've unplugged/replugged it - I've tested both the USB
> > side and the PS2 side, in either case it starts working.

> It seems like the BIOS handover of the USB input device doesn't work
> properly.
>
> The way things usually work in such situations -- BIOS is able to
> understand USB input devices in a very basic mode (hidp) and translate the
> events into PS/2-looking events, so that things like grub (which don't
> understand USB HID) are able to see keyboard events -- BIOS presents those
> as PS/2 devices.
>
> Once kernel is booted, it takes over devices in this 'legacy' mode from
> BIOS, and initializes them properly as USB input devices.
>
> Seems like this process is broken on your system. Could you please try to
> disable legacy USB emulation in your BIOS, and see if the problem
> persists? (it will make USB keyboard unavailable in grub).

Possible datapoint - the USB handoff can't be *totally* broken on the laptop,
because it handled another Microsoft Natural keyboard with a USB on it just
fine, so it's something specific to the GreenAsia adapter.

I disabled legacy USB emulation, and as expected, the keyboard wasn't available
to grub. It was *also* unavailable to the initrd until I did the 'disc/reconnect' thing,
at which point it started working. (Sorry, don't have the dmesg from that
one, can get it tomorrow (Wed) morning if you want. And any advice on
additional debugging I can turn on to help would be accepted too).



Attachments:
(No filename) (227.00 B)

2011-04-27 17:23:34

by Alan Stern

[permalink] [raw]
Subject: Re: Wonkiness with keyboard adapter - not sure if it's in USB or input systems

On Tue, 26 Apr 2011, Jiri Kosina wrote:

> It seems like the BIOS handover of the USB input device doesn't work
> properly.
>
> The way things usually work in such situations -- BIOS is able to
> understand USB input devices in a very basic mode (hidp) and translate the
> events into PS/2-looking events, so that things like grub (which don't
> understand USB HID) are able to see keyboard events -- BIOS presents those
> as PS/2 devices.
>
> Once kernel is booted, it takes over devices in this 'legacy' mode from
> BIOS, and initializes them properly as USB input devices.
>
> Seems like this process is broken on your system. Could you please try to
> disable legacy USB emulation in your BIOS, and see if the problem
> persists? (it will make USB keyboard unavailable in grub).

If the drivers are set up properly in the initrd image, this shouldn't
be a problem. Still, it's worth testing. A good test would be to use
two keyboards, one attached to the PS2 port for typing in the
decryption key and one attached to the adapter. Does the second
keyboard work after the kernel has finished starting up?

If it doesn't, does "rmmod ehci ; modprobe ehci" make any difference?

Also, once the kernel is running, it is possible to fire up usbmon and
see what it reveals.

Alan Stern

2011-04-27 17:27:22

by Dr. David Alan Gilbert

[permalink] [raw]
Subject: Re: Wonkiness with keyboard adapter - not sure if it's in USB or input systems

* [email protected] ([email protected]) wrote:
> Running 2.6.39-rc1-mmotm at the moment on a Dell Latitude E6500, that wants an
> external USB keyboard/mouse and monitor when it's in its docking station in the
> office. I have an old Microsoft Natural keyboard that has a PS/2 connector, but
> I like the tactile feel so I didn't want to get rid of it. So we recently got
> some PS2->USB adapters, which appear in lsusb as follows:
>
> Bus 001 Device 006: ID 0e8f:0020 GreenAsia Inc. USB to PS/2 Adapter
>
> Now, when I first power up the laptop in the docking station, it *does* see the
> keyboard just fine, and Grub is able to talk to it, and everything works (this
> particular boot, I was able to hit the space bar to get to the Grub menu, use
> arrow up/down to move between entries, all looked good). So it isn't like the
> device needs any initialization above and beyond what the BIOS is doing at
> initial power-on.
>
> However, when the Linux kernel starts up, it sees the adapter, but doesn't
> recognize key presses until I disconnect and then reconnect the keyboard:

I've experienced the same behaviour on at least two very different machines
(one a Tosh laptop, the other a Dell desktop), in both cases using a Model M
PS/2 keyboard connected to two different USB<->PS/2 converters (one a
really ancient Belkin one and the other a recent no-name soap-on-a-rope type
thing).

Dave

--
-----Open up your eyes, open up your mind, open up your code -------
/ Dr. David Alan Gilbert | Running GNU/Linux | Happy \
\ gro.gilbert @ treblig.org | | In Hex /
\ _________________________|_____ http://www.treblig.org |_______/