USB: fix LANGID=0 regression
commit41a96a761e60c29e4b0ae6f62b66dc639fc611d7
authorDaniel Mack <daniel@caiaq.de>
Fri, 10 Jul 2009 09:04:58 +0000 (10 11:04 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 30 Jul 2009 21:39:19 +0000 (30 14:39 -0700)
tree69348c3533fb264de1a229d4db9ee3b403ed530e
parent1f5ab002a341befd645e76fa5bd29a65c8e8138c
USB: fix LANGID=0 regression

commit 0cce2eda19923e5e5ccc8b042dec5af87b3ffad0 upstream.

commit b7af0bb ("USB: allow malformed LANGID descriptors") broke support
for devices without string descriptor support.

Reporting string descriptors is optional to USB devices, and a device
lets us know it can't deal with strings by responding to the LANGID
request with a STALL token.

The kernel handled that correctly before b7af0bb came in, but failed
hard if the LANGID was reported but broken. More than that, if a device
was not able to provide string descriptors, the LANGID was retrieved
over and over again at each string read request.

This patch changes the behaviour so that

 a) the LANGID is only queried once
 b) devices which can't handle string requests are not asked again
 c) devices with malformed LANGID values have a sane fallback to 0x0409

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/core/message.c