[PATCH v3] console: usb: kbd: Limit poll frequency to improve performance

Filip Žaludek filip.zaludek at oracle.com
Fri Jan 13 19:02:37 CET 2023




Hi Simon,
   purchased 'Logitech K120 keyboard Vend: 0x046d  Prod: 0xc31c' and 'SanDisk USB Extreme Pro 53A45678B3C1'
to mimic your setup, I can still reproduce the issue. Major discrepancy is u-boot does not recognize
SanDisk USB Extreme Pro.

Could you please share your u-boot config, config.txt, firmware version and dtbs? (Or better os image you are using for 
testing)

Could you please retest once again, but unplugged all usb devices except keyboard? Please see refined reproducer..



Prerequisities:
* RPi3B or RPi3B+
* unplugged all usb devices except keyboard, (both usb 1.1 and 2.0 tested)
* RPi3 connected to console and HDMI monitor, (monitor is not requirement)
* u-boot from master compiled without debugging as it works as workaround (reproducible with current JeOS-20230110)

Refined reproducer:
* Enter 'U-Boot>' shell using usb keyboard, (always works)
* repeat 'usb reset' until usb keyboard responds, (press ENTER, or ARROW UP followed by ENTER [to see responsiveness])
* keyboard can be resurrected by subsequent 'usb reset' from console

Workarounds:
* revert '96991e652f541323a03c5b7e075d54a117091618'
* hardcode poll_delay=0 [common/usb_kbd.c]
* enable '#define LOG_DEBUG' in [common/usb_hub.c]
* output character from semi random places [usb.c, usb_hub.c, device.c, usb-uclass.c, dwc2.c]



Cordial regards,
Filip







On 1/3/23 18:36, Filip Žaludek wrote:
> 
> 
> Hi Simon,
>   hmm this is strange. I am hitting this usually before 10 repetitions,
> for sure within 30 repetitions. 'gpu_freq' is missing, thus default.
> I can see this also from stock JeOS/RPi3 from OpenSUSE.
> Do you have enabled debug as it works as workaround? [usb_hub.c]
> 
> 
>   Dissected more, thoughts into record:
> ** not reproduced on underclocked RPi4
> ** not reproduced with hardcoded poll_delay=0 [common/usb_kbd.c]
> ** reproduced with hardcoded poll_delay=1 [common/usb_kbd.c]
> ** not reproduced when '#define LOG_DEBUG' enabled in common/usb_hub.c
> ** workaround is to output character in non 'UCLASS_USB_HUB' branch,
>   even mdelay(500) instead of printing character would not help.
> 
> 
>   Seems to be synchronization problem, please advise if you have any
> ideas/suggestions how to troubleshoot.
> 
> 
> 
> %< -------------------------------------------------------------
> diff --git a/common/usb_hub.c b/common/usb_hub.c
> index 95f1449..817e15e 100644
> --- a/common/usb_hub.c
> +++ b/common/usb_hub.c
> @@ -73,8 +73,10 @@ static inline bool usb_hub_is_superspeed(struct usb_device *hdev)
>   #if CONFIG_IS_ENABLED(DM_USB)
>   bool usb_hub_is_root_hub(struct udevice *hub)
>   {
> -       if (device_get_uclass_id(hub->parent) != UCLASS_USB_HUB)
> +       if (device_get_uclass_id(hub->parent) != UCLASS_USB_HUB) {
> +               puts(".");
>                  return true;
> +       }
> 
>          return false;
>   }
> 
> %< -------------------------------------------------------------
> 
> 
> 
> 
> 
> Happy new year!
> Regards,
> Filip
> 
> 
> 
> 
> 
> On 1/3/23 18:02, Simon Glass wrote:
>> Hi Filip,
>>
>> On Mon, 19 Dec 2022 at 14:25, Filip Žaludek <filip.zaludek at oracle.com> wrote:
>>>
>>>
>>>
>>> Hi Simon,
>>>
>>>
>>> On 12/19/22 20:20, Simon Glass wrote:
>>>> Hi Filip,
>>>>
>>>> On Mon, 19 Dec 2022 at 02:29, Filip Žaludek <filip.zaludek at oracle.com> wrote:
>>>>>
>>>>>
>>>>>
>>>>> Hi Simon,
>>>>>
>>>>>     is your testing framework connected to HDMI? Only notable discrepancy
>>>>> from generic config is enabled 'efidebug' command.
>>>>>
>>>>>
>>>>> Tested more (cycled 'U-Boot>' and 'reset'), both RPi3B and RPi3B+..
>>>>> USB Keyboard failure rates:
>>>>> connected console            02/10
>>>>> connected hdmi               06/10
>>>>> connected console + hdmi     07/10
>>>>> ** USB Keyboard always detected by 'usb info', just does not respond.
>>>>>
>>>>> USB Keyboard failure rates, reverted 96991e652f541323a03c5b7e075d54a117091618:
>>>>> connected console + hdmi     00/10
>>>>
>>>> Yes this one does have HDMI. Are you wanting me to run multiple runs?
>>>> With or without the display?
>>>
>>>
>>>    Yes please! With HDMI as there is better chance you will hit issue I am experiencing,
>>> to confirm 96991e652f541323a03c5b7e075d54a117091618 is inferior for RPi3.
>>> You should see usb_kbd detected, but no input possible.
>>
>> I am not seeing this problem, but the HDMI is not actually working. It
>> could be because of a setting in the silly config.txt file, e.g.
>> gpu_freq=250
>>
>> The display comes to life and then says no signal.
>>
>> But I tried it 10 times on us/next and the USB keyboard worked each time.
>>
>> Regards,
>> Simon


More information about the U-Boot mailing list