[SeaBIOS] [PATCH 0/1] add multiple usb-hid support

Stef van Os posted 1 patch 6 years, 4 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/seabios tags/patchew/20171215100946.58298-1-stef.van.os@prodrive-technologies.com
There is a newer version of this series
src/Kconfig      | 14 +++++++++++
src/hw/usb-hid.c | 76 ++++++++++++++++++++++++++++++++++++++++----------------
2 files changed, 68 insertions(+), 22 deletions(-)
[SeaBIOS] [PATCH 0/1] add multiple usb-hid support
Posted by Stef van Os 6 years, 4 months ago
The following patch adds support for multiple usb keyboards and mice to seabios.
Maximum number of keyboards is configurable in Kconfig and defaults to 1 to keep
current behavior.

Tested on:
* Qemu q35 with two usb keyboards on seperate displays
* Prodrive broadwell-d platform with one Dell keyboard and
  one virtual KVM keyboard on Aspeed AST2500.

Stef van Os (1):
  usb-hid: add support for multiple input devices

 src/Kconfig      | 14 +++++++++++
 src/hw/usb-hid.c | 76 ++++++++++++++++++++++++++++++++++++++++----------------
 2 files changed, 68 insertions(+), 22 deletions(-)

-- 
2.11.0


_______________________________________________
SeaBIOS mailing list
SeaBIOS@seabios.org
https://mail.coreboot.org/mailman/listinfo/seabios
Re: [SeaBIOS] [PATCH 0/1] add multiple usb-hid support
Posted by Kevin O'Connor 6 years, 4 months ago
On Fri, Dec 15, 2017 at 11:09:45AM +0100, Stef van Os wrote:
> The following patch adds support for multiple usb keyboards and mice to seabios.
> Maximum number of keyboards is configurable in Kconfig and defaults to 1 to keep
> current behavior.

Thanks.  What's the use case for enabling multiple keyboards?

-Kevin

_______________________________________________
SeaBIOS mailing list
SeaBIOS@seabios.org
https://mail.coreboot.org/mailman/listinfo/seabios
Re: [SeaBIOS] [PATCH 0/1] add multiple usb-hid support
Posted by Daniel K 6 years, 4 months ago
When I have more than 2 usb keyboards connected, SeaBIOS doesn't register keyboard input.
This persists even when I get to the disk GRUB menu.
I have to manually unplug my other keyboard to do any input during boot.

And by other keyboard, I just mean a separate numerical keypad.

>From: SeaBIOS <seabios-bounces@seabios.org> on behalf of Kevin O'Connor <kevin@koconnor.net>
>Sent: 20 December 2017 08:33
>To: Stef van Os
>Cc: seabios@seabios.org
>Subject: Re: [SeaBIOS] [PATCH 0/1] add multiple usb-hid support
>
>On Fri, Dec 15, 2017 at 11:09:45AM +0100, Stef van Os wrote:
>> The following patch adds support for multiple usb keyboards and mice to seabios.
>> Maximum number of keyboards is configurable in Kconfig and defaults to 1 to keep
>> current behavior.
> 
> Thanks.  What's the use case for enabling multiple keyboards?
> 
> -Kevin


    
_______________________________________________
SeaBIOS mailing list
SeaBIOS@seabios.org
https://mail.coreboot.org/mailman/listinfo/seabios
Re: [SeaBIOS] [PATCH 0/1] add multiple usb-hid support
Posted by Daniel K 6 years, 4 months ago
Sorry I meant more than 1 usb keyboard. So 2 or more will cause the issue.

>From: SeaBIOS <seabios-bounces@seabios.org> on behalf of Daniel K <shambles_09@hotmail.com>
>Sent: 20 December 2017 09:20
>To: Kevin O'Connor; Stef van Os
>Cc: seabios@seabios.org
>Subject: Re: [SeaBIOS] [PATCH 0/1] add multiple usb-hid support
>  
>
>When I have more than 2 usb keyboards connected, SeaBIOS doesn't register keyboard input.
>This persists even when I get to the disk GRUB menu.
>I have to manually unplug my other keyboard to do any input during boot.
>
>And by other keyboard, I just mean a separate numerical keypad.
>
>>From: SeaBIOS <seabios-bounces@seabios.org> on behalf of Kevin O'Connor <kevin@koconnor.net>
>>Sent: 20 December 2017 08:33
>>To: Stef van Os
>>Cc: seabios@seabios.org
>>Subject: Re: [SeaBIOS] [PATCH 0/1] add multiple usb-hid support
>>
>>On Fri, Dec 15, 2017 at 11:09:45AM +0100, Stef van Os wrote:
>>> The following patch adds support for multiple usb keyboards and mice to seabios.
>>> Maximum number of keyboards is configurable in Kconfig and defaults to 1 to keep
>>> current behavior.
>> 
>> Thanks.  What's the use case for enabling multiple keyboards?
>> 
>> -Kevin
_______________________________________________
SeaBIOS mailing list
SeaBIOS@seabios.org
https://mail.coreboot.org/mailman/listinfo/seabios
Re: [SeaBIOS] [PATCH 0/1] add multiple usb-hid support
Posted by Stef van Os 6 years, 4 months ago
Hi Daniel,

Is this a problem with the patch applied? It was tested on our hardware 
to function.

Some questions:
* What hardware platform are you using?
* Does the numeric keyboard work if it is the only keyboard (or if you 
swap ports, which hopefully changes enumeration order) in the system, 
maybe the problem is elsewhere and was masked because the (normal) 
keyboard was enumerated first and the second (numeric) was ignored earlier.

Also, the patch can be verified using qemu and two vnc inputs:

qemu-system-x86_64 -m 4096 -M q35 -smp 8 \
         -pflash bios.qemu.rom \
         -drive format=raw,file=disk.img \
         -device pci-bridge,addr=12.0,chassis_nr=2,id=head.2 \
         -device nec-usb-xhci,bus=head.2,addr=0f.0,id=usb.2 \
         -device VGA,id=video.1 \
         -device secondary-vga,bus=head.2,addr=02.0,id=video.2 \
         -display vnc=:15,id=primary,display=video.1 \
         -display vnc=:16,id=secondary,display=video.2 \
         -usb \
         -device usb-kbd,bus=usb.2.0,port=1,display=video.1 \
         -device usb-kbd,bus=usb.2.0,port=2,display=video.2 \
         -serial stdio

Best regards,
Stef



On 12/20/2017 06:20 PM, Daniel K wrote:
> When I have more than 2 usb keyboards connected, SeaBIOS doesn't register keyboard input.
> This persists even when I get to the disk GRUB menu.
> I have to manually unplug my other keyboard to do any input during boot.
> 
> And by other keyboard, I just mean a separate numerical keypad.
> 
>> From: SeaBIOS <seabios-bounces@seabios.org> on behalf of Kevin O'Connor <kevin@koconnor.net>
>> Sent: 20 December 2017 08:33
>> To: Stef van Os
>> Cc: seabios@seabios.org
>> Subject: Re: [SeaBIOS] [PATCH 0/1] add multiple usb-hid support
>>
>> On Fri, Dec 15, 2017 at 11:09:45AM +0100, Stef van Os wrote:
>>> The following patch adds support for multiple usb keyboards and mice to seabios.
>>> Maximum number of keyboards is configurable in Kconfig and defaults to 1 to keep
>>> current behavior.
>>
>> Thanks.  What's the use case for enabling multiple keyboards?
>>
>> -Kevin
> 
> 
>      
> 

_______________________________________________
SeaBIOS mailing list
SeaBIOS@seabios.org
https://mail.coreboot.org/mailman/listinfo/seabios
Re: [SeaBIOS] [PATCH 0/1] add multiple usb-hid support
Posted by Daniel K 6 years, 4 months ago
Hello Stef,


I'm using coreboot on an ASUS KGPE-D16 motherboard with 2x HID keyboards and 1x HID mouse.


Just tested your patch and it works but I have one suggestion.


Here's a breakdown of the test results with and without your patch when all of my USB devices are connected:


- Without the patch: No keyboard input during boot.

- With patch and CONFIG_NUM_USB_KEYBOARD=1: No keyboard input during boot. (same issue as without the patch.)

- With patch and CONFIG_NUM_USB_KEYBOARD=3: Can use both keyboards for input.


Haven't tested with =2 but there aren't any issues with 3.


The suggestion I have is to remove the CONFIG_NUM_USB_KEYBOARD / CONFIG_NUM_USB_MOUSE options you've added and just try to scan all connected USB devices.

Haven't taken a look at the code but I could give it a shot unless you have an idea about how to do it.


Hope this information helped. Attached my generated config.


Regards,

- Daniel K.

________________________________
From: Stef van Os <stef.van.os@prodrive-technologies.com>
Sent: 21 December 2017 06:13
To: Daniel K; Kevin O'Connor
Cc: seabios@seabios.org
Subject: Re: [SeaBIOS] [PATCH 0/1] add multiple usb-hid support

Hi Daniel,

Is this a problem with the patch applied? It was tested on our hardware
to function.

Some questions:
* What hardware platform are you using?
* Does the numeric keyboard work if it is the only keyboard (or if you
swap ports, which hopefully changes enumeration order) in the system,
maybe the problem is elsewhere and was masked because the (normal)
keyboard was enumerated first and the second (numeric) was ignored earlier.

Also, the patch can be verified using qemu and two vnc inputs:

qemu-system-x86_64 -m 4096 -M q35 -smp 8 \
         -pflash bios.qemu.rom \
         -drive format=raw,file=disk.img \
         -device pci-bridge,addr=12.0,chassis_nr=2,id=head.2 \
         -device nec-usb-xhci,bus=head.2,addr=0f.0,id=usb.2 \
         -device VGA,id=video.1 \
         -device secondary-vga,bus=head.2,addr=02.0,id=video.2 \
         -display vnc=:15,id=primary,display=video.1 \
         -display vnc=:16,id=secondary,display=video.2 \
         -usb \
         -device usb-kbd,bus=usb.2.0,port=1,display=video.1 \
         -device usb-kbd,bus=usb.2.0,port=2,display=video.2 \
         -serial stdio

Best regards,
Stef



On 12/20/2017 06:20 PM, Daniel K wrote:
> When I have more than 2 usb keyboards connected, SeaBIOS doesn't register keyboard input.
> This persists even when I get to the disk GRUB menu.
> I have to manually unplug my other keyboard to do any input during boot.
>
> And by other keyboard, I just mean a separate numerical keypad.
>
>> From: SeaBIOS <seabios-bounces@seabios.org> on behalf of Kevin O'Connor <kevin@koconnor.net>
>> Sent: 20 December 2017 08:33
>> To: Stef van Os
>> Cc: seabios@seabios.org
>> Subject: Re: [SeaBIOS] [PATCH 0/1] add multiple usb-hid support
>>
>> On Fri, Dec 15, 2017 at 11:09:45AM +0100, Stef van Os wrote:
>>> The following patch adds support for multiple usb keyboards and mice to seabios.
>>> Maximum number of keyboards is configurable in Kconfig and defaults to 1 to keep
>>> current behavior.
>>
>> Thanks.  What's the use case for enabling multiple keyboards?
>>
>> -Kevin
>
>
>
>
#
# Automatically generated file; DO NOT EDIT.
# SeaBIOS Configuration
#

#
# General Features
#
CONFIG_COREBOOT=y
# CONFIG_QEMU is not set
# CONFIG_CSM is not set
# CONFIG_QEMU_HARDWARE is not set
CONFIG_THREADS=y
CONFIG_RELOCATE_INIT=y
CONFIG_BOOTMENU=y
CONFIG_BOOTSPLASH=y
CONFIG_BOOTORDER=y
CONFIG_COREBOOT_FLASH=y
CONFIG_LZMA=y
CONFIG_CBFS_LOCATION=0
CONFIG_MULTIBOOT=y
CONFIG_ENTRY_EXTRASTACK=y
CONFIG_MALLOC_UPPERMEMORY=y
CONFIG_ROM_SIZE=0

#
# Hardware support
#
CONFIG_ATA=y
# CONFIG_ATA_DMA is not set
# CONFIG_ATA_PIO32 is not set
CONFIG_AHCI=y
CONFIG_SDCARD=y
CONFIG_MEGASAS=y
# CONFIG_FLOPPY is not set
# CONFIG_FLASH_FLOPPY is not set
CONFIG_NVME=y
CONFIG_PS2PORT=y
CONFIG_USB=y
CONFIG_USB_UHCI=y
CONFIG_USB_OHCI=y
CONFIG_USB_EHCI=y
CONFIG_USB_XHCI=y
CONFIG_USB_MSC=y
CONFIG_USB_UAS=y
CONFIG_USB_HUB=y
CONFIG_USB_KEYBOARD=y
CONFIG_NUM_USB_KEYBOARD=3
CONFIG_USB_MOUSE=y
CONFIG_NUM_USB_MOUSE=1
CONFIG_SERIAL=y
CONFIG_SERCON=y
CONFIG_LPT=y
CONFIG_RTC_TIMER=y
CONFIG_HARDWARE_IRQ=y
CONFIG_PMTIMER=y
CONFIG_TSC_TIMER=y

#
# BIOS interfaces
#
CONFIG_DRIVES=y
# CONFIG_CDROM_BOOT is not set
CONFIG_PCIBIOS=y
CONFIG_APMBIOS=y
CONFIG_PNPBIOS=y
CONFIG_OPTIONROMS=y
CONFIG_PMM=y
CONFIG_BOOT=y
CONFIG_KEYBOARD=y
CONFIG_KBD_CALL_INT15_4F=y
CONFIG_MOUSE=y
CONFIG_S3_RESUME=y
CONFIG_VGAHOOKS=y
# CONFIG_DISABLE_A20 is not set
CONFIG_TCGBIOS=y

#
# VGA ROM
#
# CONFIG_NO_VGABIOS is not set
# CONFIG_VGA_GEODEGX2 is not set
# CONFIG_VGA_GEODELX is not set
CONFIG_VGA_COREBOOT=y
CONFIG_BUILD_VGABIOS=y
CONFIG_VGA_EMULATE_TEXT=y
CONFIG_VGA_FIXUP_ASM=y
CONFIG_VGA_ALLOCATE_EXTRA_STACK=y
CONFIG_VGA_EXTRA_STACK_SIZE=512
CONFIG_VGA_VBE=y

#
# Debugging
#
CONFIG_DEBUG_LEVEL=4
# CONFIG_DEBUG_SERIAL is not set
# CONFIG_DEBUG_SERIAL_MMIO is not set
CONFIG_DEBUG_COREBOOT=y
_______________________________________________
SeaBIOS mailing list
SeaBIOS@seabios.org
https://mail.coreboot.org/mailman/listinfo/seabios
Re: [SeaBIOS] [PATCH 0/1] add multiple usb-hid support
Posted by Stef van Os 6 years, 4 months ago
Hi Kevin,

The use case is that on many boards there is a BMC emulating a 
keyboard/mouse device (the Aspeed AST2500 in our case). This device is 
always on, and enumerated first.

This meant that in our case we were never able to use both a "real" 
keyboard to select the boot mode in SeaBIOS, and the network KVM via the 
Aspeed at the same time.

With this patch (and multiple keyboards configured in Kconfig) we do not 
have this limitation anymore, and can use both the network KVM remote, 
as well as a "real" keyboard on the device to select e.g. network boot 
or USB install medium.

Br,

Stef

On 12/20/2017 05:33 PM, Kevin O'Connor wrote:
> On Fri, Dec 15, 2017 at 11:09:45AM +0100, Stef van Os wrote:
>> The following patch adds support for multiple usb keyboards and mice to seabios.
>> Maximum number of keyboards is configurable in Kconfig and defaults to 1 to keep
>> current behavior.
> 
> Thanks.  What's the use case for enabling multiple keyboards?
> 
> -Kevin
> 

_______________________________________________
SeaBIOS mailing list
SeaBIOS@seabios.org
https://mail.coreboot.org/mailman/listinfo/seabios
Re: [SeaBIOS] [PATCH 0/1] add multiple usb-hid support
Posted by Kevin O'Connor 6 years, 4 months ago
On Thu, Dec 21, 2017 at 11:47:40AM +0100, Stef van Os wrote:
> Hi Kevin,
> 
> The use case is that on many boards there is a BMC emulating a
> keyboard/mouse device (the Aspeed AST2500 in our case). This device is
> always on, and enumerated first.
> 
> This meant that in our case we were never able to use both a "real" keyboard
> to select the boot mode in SeaBIOS, and the network KVM via the Aspeed at
> the same time.
> 
> With this patch (and multiple keyboards configured in Kconfig) we do not
> have this limitation anymore, and can use both the network KVM remote, as
> well as a "real" keyboard on the device to select e.g. network boot or USB
> install medium.

Okay, thanks.  That makes sense.

I agree with Daniel that it would be preferable to do this without a
kconfig option.  Perhaps put all of the keyboards in a linked list?
(FYI, I don't see any reason to support multiple mice, as no one uses
the old dos mouse interface anyway.)

-Kevin

_______________________________________________
SeaBIOS mailing list
SeaBIOS@seabios.org
https://mail.coreboot.org/mailman/listinfo/seabios