* USB Gadget Filesystem HID stuck on write when using mass storage at the same time
@ 2021-06-29 13:45 Benjamin Marty
2021-06-29 17:19 ` Greg KH
0 siblings, 1 reply; 6+ messages in thread
From: Benjamin Marty @ 2021-06-29 13:45 UTC (permalink / raw)
To: linux-usb
Hello
In my application, I boot a Linux System through USB Gadget mass
storage and at the same time pass in USB Touch commands via USB HID
Device. Both over the same USB OTG Gadget Link.
If I execute USB HID commands during high traffic over the USB Mass
Storage, the HID device gets stuck. Writes to it are then blocking
forever. I'm not sure if I use something wrong or if this is a Kernel
issue. Do I maybe need to check something before I'm allowed to write
to the HID device?
Hardware issue are unlikely, I tried it on the Raspberry Pi Platform
and also on the NXP iMX8MM platform. Both have this HID device stuck
issue. I have also tried multiple Intel Computers as USB Host.
I tried to document my issue here with test scripts to replicate what
I do in my C Application with the same result:
https://github.com/raspberrypi/linux/issues/4373
Thanks
Benjamin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: USB Gadget Filesystem HID stuck on write when using mass storage at the same time
2021-06-29 13:45 USB Gadget Filesystem HID stuck on write when using mass storage at the same time Benjamin Marty
@ 2021-06-29 17:19 ` Greg KH
2021-06-30 8:55 ` Benjamin Marty
0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2021-06-29 17:19 UTC (permalink / raw)
To: Benjamin Marty; +Cc: linux-usb
On Tue, Jun 29, 2021 at 03:45:46PM +0200, Benjamin Marty wrote:
> Hello
>
> In my application, I boot a Linux System through USB Gadget mass
> storage and at the same time pass in USB Touch commands via USB HID
> Device. Both over the same USB OTG Gadget Link.
>
> If I execute USB HID commands during high traffic over the USB Mass
> Storage, the HID device gets stuck. Writes to it are then blocking
> forever. I'm not sure if I use something wrong or if this is a Kernel
> issue. Do I maybe need to check something before I'm allowed to write
> to the HID device?
>
> Hardware issue are unlikely, I tried it on the Raspberry Pi Platform
> and also on the NXP iMX8MM platform. Both have this HID device stuck
> issue. I have also tried multiple Intel Computers as USB Host.
>
> I tried to document my issue here with test scripts to replicate what
> I do in my C Application with the same result:
> https://github.com/raspberrypi/linux/issues/4373
What kernel version are you using for your device?
What is locking up, the kernel on the device, or the kernel on the USB
host side?
And have you used usbmon to look at the USB traffic to ensure that you
really are sending the data you think you are sending?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: USB Gadget Filesystem HID stuck on write when using mass storage at the same time
2021-06-29 17:19 ` Greg KH
@ 2021-06-30 8:55 ` Benjamin Marty
2021-06-30 9:28 ` Greg KH
0 siblings, 1 reply; 6+ messages in thread
From: Benjamin Marty @ 2021-06-30 8:55 UTC (permalink / raw)
Cc: linux-usb
On the iMX8 device `Linux imx8mm-var-dart 5.4.3-g050b21f4b394 #1 SMP
PREEMPT Fri Oct 9 11:36:53 PDT 2020 aarch64 GNU/Linux` and on the
Raspberry Pi device `Linux raspberry 5.10.17-v7l+ #1403 SMP Mon Feb 22
11:33:35 GMT 2021 armv7l GNU/Linux`.
File write to `/dev/hidg0` starts to hang when there was high mass
storage traffic. It also doesn't recover itself. There is no `complete
kernel lockup`.
I haven't used usbmon yet but if I don't have high traffic scenarios
on the mass storage then the mass storage and HID device works as
expected. So I'm confident that I send the correct data.
Also saw that I'm getting this error in dmesg on both devices:
[ 1895.677053] configfs-gadget gadget: End Point Request ERROR: -108
Thanks
Benjamin
Am Di., 29. Juni 2021 um 19:20 Uhr schrieb Greg KH <gregkh@linuxfoundation.org>:
>
> On Tue, Jun 29, 2021 at 03:45:46PM +0200, Benjamin Marty wrote:
> > Hello
> >
> > In my application, I boot a Linux System through USB Gadget mass
> > storage and at the same time pass in USB Touch commands via USB HID
> > Device. Both over the same USB OTG Gadget Link.
> >
> > If I execute USB HID commands during high traffic over the USB Mass
> > Storage, the HID device gets stuck. Writes to it are then blocking
> > forever. I'm not sure if I use something wrong or if this is a Kernel
> > issue. Do I maybe need to check something before I'm allowed to write
> > to the HID device?
> >
> > Hardware issue are unlikely, I tried it on the Raspberry Pi Platform
> > and also on the NXP iMX8MM platform. Both have this HID device stuck
> > issue. I have also tried multiple Intel Computers as USB Host.
> >
> > I tried to document my issue here with test scripts to replicate what
> > I do in my C Application with the same result:
> > https://github.com/raspberrypi/linux/issues/4373
>
> What kernel version are you using for your device?
>
> What is locking up, the kernel on the device, or the kernel on the USB
> host side?
>
> And have you used usbmon to look at the USB traffic to ensure that you
> really are sending the data you think you are sending?
>
> thanks,
>
> greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: USB Gadget Filesystem HID stuck on write when using mass storage at the same time
2021-06-30 8:55 ` Benjamin Marty
@ 2021-06-30 9:28 ` Greg KH
2021-06-30 10:25 ` Benjamin Marty
0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2021-06-30 9:28 UTC (permalink / raw)
To: Benjamin Marty; +Cc: linux-usb
A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
A: No.
Q: Should I include quotations after my reply?
http://daringfireball.net/2007/07/on_top
On Wed, Jun 30, 2021 at 10:55:04AM +0200, Benjamin Marty wrote:
> On the iMX8 device `Linux imx8mm-var-dart 5.4.3-g050b21f4b394 #1 SMP
> PREEMPT Fri Oct 9 11:36:53 PDT 2020 aarch64 GNU/Linux` and on the
> Raspberry Pi device `Linux raspberry 5.10.17-v7l+ #1403 SMP Mon Feb 22
> 11:33:35 GMT 2021 armv7l GNU/Linux`.
I do not understand, which is the host and which is the gadget here?
> File write to `/dev/hidg0` starts to hang when there was high mass
> storage traffic. It also doesn't recover itself. There is no `complete
> kernel lockup`.
File write on the host or gadget?
If things are not locked up, what is stalled?
> I haven't used usbmon yet but if I don't have high traffic scenarios
> on the mass storage then the mass storage and HID device works as
> expected. So I'm confident that I send the correct data.
That's fine, but it is good to use usbmon to see what the errors are as
well when things go wrong.
> Also saw that I'm getting this error in dmesg on both devices:
> [ 1895.677053] configfs-gadget gadget: End Point Request ERROR: -108
Ah, is your userspace code on the gadget not handling this properly?
What userspace code is running on the gadget for your USB device
emulation?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: USB Gadget Filesystem HID stuck on write when using mass storage at the same time
2021-06-30 9:28 ` Greg KH
@ 2021-06-30 10:25 ` Benjamin Marty
2021-07-01 11:04 ` Greg KH
0 siblings, 1 reply; 6+ messages in thread
From: Benjamin Marty @ 2021-06-30 10:25 UTC (permalink / raw)
To: Greg KH; +Cc: linux-usb
Am Mi., 30. Juni 2021 um 11:28 Uhr schrieb Greg KH <gregkh@linuxfoundation.org>:
> On Wed, Jun 30, 2021 at 10:55:04AM +0200, Benjamin Marty wrote:
> > On the iMX8 device `Linux imx8mm-var-dart 5.4.3-g050b21f4b394 #1 SMP
> > PREEMPT Fri Oct 9 11:36:53 PDT 2020 aarch64 GNU/Linux` and on the
> > Raspberry Pi device `Linux raspberry 5.10.17-v7l+ #1403 SMP Mon Feb 22
> > 11:33:35 GMT 2021 armv7l GNU/Linux`.
>
> I do not understand, which is the host and which is the gadget here?
I use both as Gadget, two different HW platforms to rule out a
Hardware related issue.
As Host, I've tried multiple normal Intel computers.
I was able to reproduce this issue with all HW Combinations
> > File write to `/dev/hidg0` starts to hang when there was high mass
> > storage traffic. It also doesn't recover itself. There is no `complete
> > kernel lockup`.
>
> File write on the host or gadget?
File write on the gadget to the gadget HID device `/dev/hidg0`
> If things are not locked up, what is stalled?
The File write to the gadget HID device is stalled.
> > I haven't used usbmon yet but if I don't have high traffic scenarios
> > on the mass storage then the mass storage and HID device works as
> > expected. So I'm confident that I send the correct data.
>
> That's fine, but it is good to use usbmon to see what the errors are as
> well when things go wrong.
Unfortunately both Kernel Versions don't have the usbmon module, need
to recompile the Kernel first.
> > Also saw that I'm getting this error in dmesg on both devices:
> > [ 1895.677053] configfs-gadget gadget: End Point Request ERROR: -108
>
> Ah, is your userspace code on the gadget not handling this properly?
> What userspace code is running on the gadget for your USB device
> emulation?
Yes, my userspace code is on the gadget. It runs after I've setup the
gadget HID + gadget Mass Storage. But it starts to fail after High
Traffic scenarios to the gadget Mass Storage.
To replicate the issue, I wrote a simple Bash script which just
wiggles the gadget HID (Mouse) every 50ms:
while true; do
if [ -e "/dev/hidg0" ]; then
echo write0
echo \\x00\\xff\\xff\\x00\\xff\\xff > /dev/hidg0
sleep 0.05
echo write1
echo \\x00\\xff\\xff\\x00\\xff\\x00 > /dev/hidg0
sleep 0.05
fi
done
Do I need to check something before writing to the gadget HID device?
Or should this usage of the gadget HID device be fine?
Thanks
Benjamin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: USB Gadget Filesystem HID stuck on write when using mass storage at the same time
2021-06-30 10:25 ` Benjamin Marty
@ 2021-07-01 11:04 ` Greg KH
0 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2021-07-01 11:04 UTC (permalink / raw)
To: Benjamin Marty; +Cc: linux-usb
On Wed, Jun 30, 2021 at 12:25:09PM +0200, Benjamin Marty wrote:
> Am Mi., 30. Juni 2021 um 11:28 Uhr schrieb Greg KH <gregkh@linuxfoundation.org>:
> > On Wed, Jun 30, 2021 at 10:55:04AM +0200, Benjamin Marty wrote:
> > > On the iMX8 device `Linux imx8mm-var-dart 5.4.3-g050b21f4b394 #1 SMP
> > > PREEMPT Fri Oct 9 11:36:53 PDT 2020 aarch64 GNU/Linux` and on the
> > > Raspberry Pi device `Linux raspberry 5.10.17-v7l+ #1403 SMP Mon Feb 22
> > > 11:33:35 GMT 2021 armv7l GNU/Linux`.
> >
> > I do not understand, which is the host and which is the gadget here?
>
> I use both as Gadget, two different HW platforms to rule out a
> Hardware related issue.
> As Host, I've tried multiple normal Intel computers.
What OS is running on the host?
> I was able to reproduce this issue with all HW Combinations
Then perhaps your userspace code running on the gadget is not working
properly?
> > > File write to `/dev/hidg0` starts to hang when there was high mass
> > > storage traffic. It also doesn't recover itself. There is no `complete
> > > kernel lockup`.
> >
> > File write on the host or gadget?
>
> File write on the gadget to the gadget HID device `/dev/hidg0`
What do you do if that fails?
> > If things are not locked up, what is stalled?
>
> The File write to the gadget HID device is stalled.
What gadget controller driver are you using?
> > > I haven't used usbmon yet but if I don't have high traffic scenarios
> > > on the mass storage then the mass storage and HID device works as
> > > expected. So I'm confident that I send the correct data.
> >
> > That's fine, but it is good to use usbmon to see what the errors are as
> > well when things go wrong.
>
> Unfortunately both Kernel Versions don't have the usbmon module, need
> to recompile the Kernel first.
Try that, on the host, it should be part of any normal Linux distro
kernel already.
> > > Also saw that I'm getting this error in dmesg on both devices:
> > > [ 1895.677053] configfs-gadget gadget: End Point Request ERROR: -108
> >
> > Ah, is your userspace code on the gadget not handling this properly?
> > What userspace code is running on the gadget for your USB device
> > emulation?
>
> Yes, my userspace code is on the gadget. It runs after I've setup the
> gadget HID + gadget Mass Storage. But it starts to fail after High
> Traffic scenarios to the gadget Mass Storage.
>
> To replicate the issue, I wrote a simple Bash script which just
> wiggles the gadget HID (Mouse) every 50ms:
>
> while true; do
> if [ -e "/dev/hidg0" ]; then
> echo write0
> echo \\x00\\xff\\xff\\x00\\xff\\xff > /dev/hidg0
> sleep 0.05
> echo write1
> echo \\x00\\xff\\xff\\x00\\xff\\x00 > /dev/hidg0
> sleep 0.05
> fi
> done
>
> Do I need to check something before writing to the gadget HID device?
> Or should this usage of the gadget HID device be fine?
I do not know, sorry.
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-07-01 11:04 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-29 13:45 USB Gadget Filesystem HID stuck on write when using mass storage at the same time Benjamin Marty
2021-06-29 17:19 ` Greg KH
2021-06-30 8:55 ` Benjamin Marty
2021-06-30 9:28 ` Greg KH
2021-06-30 10:25 ` Benjamin Marty
2021-07-01 11:04 ` Greg KH
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.