linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] USB: Add quirk for WORLDE easykey.25 MIDI keyboard
@ 2017-01-20 18:46 Lukáš Lalinský
  2017-01-21  9:08 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 7+ messages in thread
From: Lukáš Lalinský @ 2017-01-20 18:46 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel; +Cc: Lukáš Lalinský

Add a quirk for WORLDE easykey.25 MIDI keyboard (idVendor=0218,
idProduct=0401). The device reports that it has config string
descriptor at index 3, but when the system selects the configuration
and tries to get the description, it returns a -EPROTO error,
the communication restarts and this keeps repeating over and over again.
Not requesting the string descriptor makes the device work correctly.

Relevant info from Wireshark:

[...]

CONFIGURATION DESCRIPTOR
    bLength: 9
    bDescriptorType: 0x02 (CONFIGURATION)
    wTotalLength: 101
    bNumInterfaces: 2
    bConfigurationValue: 1
    iConfiguration: 3
    Configuration bmAttributes: 0xc0  SELF-POWERED  NO REMOTE-WAKEUP
        1... .... = Must be 1: Must be 1 for USB 1.1 and higher
        .1.. .... = Self-Powered: This device is SELF-POWERED
        ..0. .... = Remote Wakeup: This device does NOT support remote wakeup
    bMaxPower: 50  (100mA)

[...]

     45 0.369104       host                  2.38.0                USB      64     GET DESCRIPTOR Request STRING

[...]

URB setup
    bmRequestType: 0x80
        1... .... = Direction: Device-to-host
        .00. .... = Type: Standard (0x00)
        ...0 0000 = Recipient: Device (0x00)
    bRequest: GET DESCRIPTOR (6)
    Descriptor Index: 0x03
    bDescriptorType: 0x03
    Language Id: English (United States) (0x0409)
    wLength: 255

     46 0.369255       2.38.0                host                  USB      64     GET DESCRIPTOR Response STRING[Malformed Packet]

[...]

Frame 46: 64 bytes on wire (512 bits), 64 bytes captured (512 bits) on interface 0
USB URB
    [Source: 2.38.0]
    [Destination: host]
    URB id: 0xffff88021f62d480
    URB type: URB_COMPLETE ('C')
    URB transfer type: URB_CONTROL (0x02)
    Endpoint: 0x80, Direction: IN
    Device: 38
    URB bus id: 2
    Device setup request: not relevant ('-')
    Data: present (0)
    URB sec: 1484896277
    URB usec: 455031
    URB status: Protocol error (-EPROTO) (-71)
    URB length [bytes]: 0
    Data length [bytes]: 0
    [Request in: 45]
    [Time from request: 0.000151000 seconds]
    Unused Setup Header
    Interval: 0
    Start frame: 0
    Copy of Transfer Flags: 0x00000200
    Number of ISO descriptors: 0
[Malformed Packet: USB]
    [Expert Info (Error/Malformed): Malformed Packet (Exception occurred)]
        [Malformed Packet (Exception occurred)]
        [Severity level: Error]
        [Group: Malformed]

Signed-off-by: Lukáš Lalinský <lukas@oxygene.sk>
---
 drivers/usb/core/quirks.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index d2e50a2..24f9f98 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -37,6 +37,10 @@ static const struct usb_device_id usb_quirk_list[] = {
 	/* CBM - Flash disk */
 	{ USB_DEVICE(0x0204, 0x6025), .driver_info = USB_QUIRK_RESET_RESUME },
 
+	/* WORLDE easy key (easykey.25) MIDI controller  */
+	{ USB_DEVICE(0x0218, 0x0401), .driver_info =
+			USB_QUIRK_CONFIG_INTF_STRINGS },
+
 	/* HP 5300/5370C scanner */
 	{ USB_DEVICE(0x03f0, 0x0701), .driver_info =
 			USB_QUIRK_STRING_FETCH_255 },
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] USB: Add quirk for WORLDE easykey.25 MIDI keyboard
  2017-01-20 18:46 [PATCH] USB: Add quirk for WORLDE easykey.25 MIDI keyboard Lukáš Lalinský
@ 2017-01-21  9:08 ` Greg Kroah-Hartman
  2017-01-23 18:36   ` Lukáš Lalinský
  0 siblings, 1 reply; 7+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-21  9:08 UTC (permalink / raw)
  To: Lukáš Lalinský; +Cc: linux-kernel, linux-usb

On Fri, Jan 20, 2017 at 07:46:34PM +0100, Lukáš Lalinský wrote:
> Add a quirk for WORLDE easykey.25 MIDI keyboard (idVendor=0218,
> idProduct=0401). The device reports that it has config string
> descriptor at index 3, but when the system selects the configuration
> and tries to get the description, it returns a -EPROTO error,
> the communication restarts and this keeps repeating over and over again.
> Not requesting the string descriptor makes the device work correctly.

Always use scripts/get_maintainer.pl to determine who to send patches
to, and what mailing list.  You forgot linux-usb@vger, which I've now
added...

> 
> Relevant info from Wireshark:
> 
> [...]
> 
> CONFIGURATION DESCRIPTOR
>     bLength: 9
>     bDescriptorType: 0x02 (CONFIGURATION)
>     wTotalLength: 101
>     bNumInterfaces: 2
>     bConfigurationValue: 1
>     iConfiguration: 3
>     Configuration bmAttributes: 0xc0  SELF-POWERED  NO REMOTE-WAKEUP
>         1... .... = Must be 1: Must be 1 for USB 1.1 and higher
>         .1.. .... = Self-Powered: This device is SELF-POWERED
>         ..0. .... = Remote Wakeup: This device does NOT support remote wakeup
>     bMaxPower: 50  (100mA)
> 
> [...]
> 
>      45 0.369104       host                  2.38.0                USB      64     GET DESCRIPTOR Request STRING
> 
> [...]
> 
> URB setup
>     bmRequestType: 0x80
>         1... .... = Direction: Device-to-host
>         .00. .... = Type: Standard (0x00)
>         ...0 0000 = Recipient: Device (0x00)
>     bRequest: GET DESCRIPTOR (6)
>     Descriptor Index: 0x03
>     bDescriptorType: 0x03
>     Language Id: English (United States) (0x0409)
>     wLength: 255
> 
>      46 0.369255       2.38.0                host                  USB      64     GET DESCRIPTOR Response STRING[Malformed Packet]
> 
> [...]
> 
> Frame 46: 64 bytes on wire (512 bits), 64 bytes captured (512 bits) on interface 0
> USB URB
>     [Source: 2.38.0]
>     [Destination: host]
>     URB id: 0xffff88021f62d480
>     URB type: URB_COMPLETE ('C')
>     URB transfer type: URB_CONTROL (0x02)
>     Endpoint: 0x80, Direction: IN
>     Device: 38
>     URB bus id: 2
>     Device setup request: not relevant ('-')
>     Data: present (0)
>     URB sec: 1484896277
>     URB usec: 455031
>     URB status: Protocol error (-EPROTO) (-71)
>     URB length [bytes]: 0
>     Data length [bytes]: 0
>     [Request in: 45]
>     [Time from request: 0.000151000 seconds]
>     Unused Setup Header
>     Interval: 0
>     Start frame: 0
>     Copy of Transfer Flags: 0x00000200
>     Number of ISO descriptors: 0
> [Malformed Packet: USB]
>     [Expert Info (Error/Malformed): Malformed Packet (Exception occurred)]
>         [Malformed Packet (Exception occurred)]
>         [Severity level: Error]
>         [Group: Malformed]
> 
> Signed-off-by: Lukáš Lalinský <lukas@oxygene.sk>
> ---
>  drivers/usb/core/quirks.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
> index d2e50a2..24f9f98 100644
> --- a/drivers/usb/core/quirks.c
> +++ b/drivers/usb/core/quirks.c
> @@ -37,6 +37,10 @@ static const struct usb_device_id usb_quirk_list[] = {
>  	/* CBM - Flash disk */
>  	{ USB_DEVICE(0x0204, 0x6025), .driver_info = USB_QUIRK_RESET_RESUME },
>  
> +	/* WORLDE easy key (easykey.25) MIDI controller  */
> +	{ USB_DEVICE(0x0218, 0x0401), .driver_info =
> +			USB_QUIRK_CONFIG_INTF_STRINGS },

That's odd, how does other operating systems handle this device?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] USB: Add quirk for WORLDE easykey.25 MIDI keyboard
  2017-01-21  9:08 ` Greg Kroah-Hartman
@ 2017-01-23 18:36   ` Lukáš Lalinský
  2017-01-24  7:32     ` Oliver Neukum
  0 siblings, 1 reply; 7+ messages in thread
From: Lukáš Lalinský @ 2017-01-23 18:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, linux-usb

On Sat, Jan 21, 2017 at 10:08 AM, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> Always use scripts/get_maintainer.pl to determine who to send patches
> to, and what mailing list.  You forgot linux-usb@vger, which I've now
> added...

I'm sorry about that. I actually did use scripts/get_maintainer.pl,
but it only returned your email address and I added linux-kernel@vger
myself. I guess I ran it with wrong options.

> That's odd, how does other operating systems handle this device?

I'm not sure how realistic this test is, but I ran a Wireshark capture
from Windows 8.1 VM and it seems that for this particular device,
Windows doesn't try to set the current configuration (since there is
only one) and it does not even attempt to get the configuration string
descriptor. I'm not sure if Windows does this in general, but it seems
to work around the problem for this device by not caring about the
configuration string descriptor in the first place.

I have uploaded both captures here -
https://gist.github.com/lalinsky/83148a827d5cd43e79e377d8e1b5ed0d

Lukas

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] USB: Add quirk for WORLDE easykey.25 MIDI keyboard
  2017-01-23 18:36   ` Lukáš Lalinský
@ 2017-01-24  7:32     ` Oliver Neukum
  2017-01-24  7:37       ` Lukáš Lalinský
  0 siblings, 1 reply; 7+ messages in thread
From: Oliver Neukum @ 2017-01-24  7:32 UTC (permalink / raw)
  To: Lukáš Lalinský, Greg Kroah-Hartman; +Cc: linux-kernel, linux-usb

Am Montag, den 23.01.2017, 19:36 +0100 schrieb Lukáš Lalinský:
> On Sat, Jan 21, 2017 at 10:08 AM, Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> > 
> > Always use scripts/get_maintainer.pl to determine who to send
> > patches
> > to, and what mailing list.  You forgot linux-usb@vger, which I've
> > now
> > added...
> 
> I'm sorry about that. I actually did use scripts/get_maintainer.pl,
> but it only returned your email address and I added linux-kernel@vger
> myself. I guess I ran it with wrong options.
> 
> > 
> > That's odd, how does other operating systems handle this device?
> 
> I'm not sure how realistic this test is, but I ran a Wireshark
> capture
> from Windows 8.1 VM and it seems that for this particular device,
> Windows doesn't try to set the current configuration (since there is
> only one) and it does not even attempt to get the configuration
> string
> descriptor. I'm not sure if Windows does this in general, but it
> seems
> to work around the problem for this device by not caring about the
> configuration string descriptor in the first place.
> 
> I have uploaded both captures here -
> https://gist.github.com/lalinsky/83148a827d5cd43e79e377d8e1b5ed0d

Indeed it is does not set a configuration. Either the capture
is incomplete or device and host violate the standard. A device
may be left unconfigured. We need to read the descriptors even if we
see only one configuration to get the power budgeting right.

Does the device work without any .ini file?

	Regards
		Oliver

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] USB: Add quirk for WORLDE easykey.25 MIDI keyboard
  2017-01-24  7:32     ` Oliver Neukum
@ 2017-01-24  7:37       ` Lukáš Lalinský
  2017-01-24  8:30         ` Oliver Neukum
  2017-01-24  8:31         ` Lukáš Lalinský
  0 siblings, 2 replies; 7+ messages in thread
From: Lukáš Lalinský @ 2017-01-24  7:37 UTC (permalink / raw)
  To: Oliver Neukum; +Cc: Greg Kroah-Hartman, linux-kernel, linux-usb

On Tue, Jan 24, 2017 at 8:32 AM, Oliver Neukum <oneukum@suse.com> wrote:
> Am Montag, den 23.01.2017, 19:36 +0100 schrieb Lukáš Lalinský:
>> I have uploaded both captures here -
>> https://gist.github.com/lalinsky/83148a827d5cd43e79e377d8e1b5ed0d
>
> Indeed it is does not set a configuration. Either the capture
> is incomplete or device and host violate the standard. A device
> may be left unconfigured.

Is this may or may not? I'm not familiar with USB, so I assumed if
there is only one configuration and there is always one active, it
does not need to be set explicitly because the correct one is already
active.

> We need to read the descriptors even if we
> see only one configuration to get the power budgeting right.

Aren't those in the CONFIGURATION descriptors? Reading the STRING
descriptor is probably only useful if you need to print the
configuration details somewhere.

> Does the device work without any .ini file?

Yes. It's a standard MIDI device, no configuration is required.

Lukas

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] USB: Add quirk for WORLDE easykey.25 MIDI keyboard
  2017-01-24  7:37       ` Lukáš Lalinský
@ 2017-01-24  8:30         ` Oliver Neukum
  2017-01-24  8:31         ` Lukáš Lalinský
  1 sibling, 0 replies; 7+ messages in thread
From: Oliver Neukum @ 2017-01-24  8:30 UTC (permalink / raw)
  To: Lukáš Lalinský; +Cc: Greg Kroah-Hartman, linux-kernel, linux-usb

Am Dienstag, den 24.01.2017, 08:37 +0100 schrieb Lukáš Lalinský:
> On Tue, Jan 24, 2017 at 8:32 AM, Oliver Neukum <oneukum@suse.com>
> wrote:
> > 
> > Am Montag, den 23.01.2017, 19:36 +0100 schrieb Lukáš Lalinský:
> > > 
> > > I have uploaded both captures here -
> > > https://gist.github.com/lalinsky/83148a827d5cd43e79e377d8e1b5ed0d
> > 
> > Indeed it is does not set a configuration. Either the capture
> > is incomplete or device and host violate the standard. A device
> > may be left unconfigured.
> 
> Is this may or may not? I'm not familiar with USB, so I assumed if

You can leave a device unconfigured. In that case it stays in the
addressed state, where its power draw is strictly limited.
That is exactly what the kernel does when it is confronted with
a device that would overdraw the power budget.

> there is only one configuration and there is always one active, it
> does not need to be set explicitly because the correct one is already
> active.

No, it is not. Or rather it should not be. Can you please recheck
that you are capturing the whole exchange?

> > We need to read the descriptors even if we
> > see only one configuration to get the power budgeting right.
> 
> Aren't those in the CONFIGURATION descriptors? Reading the STRING

True.

> descriptor is probably only useful if you need to print the
> configuration details somewhere.

Also true.

> > 
> > Does the device work without any .ini file?
> 
> Yes. It's a standard MIDI device, no configuration is required.

So Windows by default does not read string descriptors. That is worth
a thought, but we need to check. Yet I am not sure how useful that is.
The first lsusb would crash the device. We'd need a quirk anyway.

	Regards
		Oliver

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] USB: Add quirk for WORLDE easykey.25 MIDI keyboard
  2017-01-24  7:37       ` Lukáš Lalinský
  2017-01-24  8:30         ` Oliver Neukum
@ 2017-01-24  8:31         ` Lukáš Lalinský
  1 sibling, 0 replies; 7+ messages in thread
From: Lukáš Lalinský @ 2017-01-24  8:31 UTC (permalink / raw)
  To: Oliver Neukum; +Cc: Greg Kroah-Hartman, linux-kernel, linux-usb

On Tue, Jan 24, 2017 at 8:37 AM, Lukáš Lalinský <lukas@oxygene.sk> wrote:
> On Tue, Jan 24, 2017 at 8:32 AM, Oliver Neukum <oneukum@suse.com> wrote:
>> Am Montag, den 23.01.2017, 19:36 +0100 schrieb Lukáš Lalinský:
>>> I have uploaded both captures here -
>>> https://gist.github.com/lalinsky/83148a827d5cd43e79e377d8e1b5ed0d
>>
>> Indeed it is does not set a configuration. Either the capture
>> is incomplete or device and host violate the standard. A device
>> may be left unconfigured.
>
> Is this may or may not? I'm not familiar with USB, so I assumed if
> there is only one configuration and there is always one active, it
> does not need to be set explicitly because the correct one is already
> active.
>
>> We need to read the descriptors even if we
>> see only one configuration to get the power budgeting right.
>
> Aren't those in the CONFIGURATION descriptors? Reading the STRING
> descriptor is probably only useful if you need to print the
> configuration details somewhere.

I re-ran the capture on a Windows 7 host. The previous capture was
missing data, probably due to interactions of the Linux host and
Windows VM.

https://gist.github.com/lalinsky/2ec7d74b049b448b1f7032d8861ca4a2

It does set the configuration, but does not request the string descriptor.

Lukas

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-01-24  8:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-20 18:46 [PATCH] USB: Add quirk for WORLDE easykey.25 MIDI keyboard Lukáš Lalinský
2017-01-21  9:08 ` Greg Kroah-Hartman
2017-01-23 18:36   ` Lukáš Lalinský
2017-01-24  7:32     ` Oliver Neukum
2017-01-24  7:37       ` Lukáš Lalinský
2017-01-24  8:30         ` Oliver Neukum
2017-01-24  8:31         ` Lukáš Lalinský

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).