Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

USB: serial: ir-usb: fix link-speed handling

Commit e0d795e4f36c ("usb: irda: cleanup on ir-usb module") added a USB
IrDA header with common defines, but mistakingly switched to using the
class-descriptor baud-rate bitmask values for the outbound header.

This broke link-speed handling for rates above 9600 baud, but a device
would also be able to operate at the default 9600 baud until a
link-speed request was issued (e.g. using the TCGETS ioctl).

Fixes: e0d795e4f36c ("usb: irda: cleanup on ir-usb module")
Cc: stable <stable@vger.kernel.org> # 2.6.27
Cc: Felipe Balbi <balbi@kernel.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>

+22 -11
+10 -10
drivers/usb/serial/ir-usb.c
··· 335 335 336 336 switch (baud) { 337 337 case 2400: 338 - ir_baud = USB_IRDA_BR_2400; 338 + ir_baud = USB_IRDA_LS_2400; 339 339 break; 340 340 case 9600: 341 - ir_baud = USB_IRDA_BR_9600; 341 + ir_baud = USB_IRDA_LS_9600; 342 342 break; 343 343 case 19200: 344 - ir_baud = USB_IRDA_BR_19200; 344 + ir_baud = USB_IRDA_LS_19200; 345 345 break; 346 346 case 38400: 347 - ir_baud = USB_IRDA_BR_38400; 347 + ir_baud = USB_IRDA_LS_38400; 348 348 break; 349 349 case 57600: 350 - ir_baud = USB_IRDA_BR_57600; 350 + ir_baud = USB_IRDA_LS_57600; 351 351 break; 352 352 case 115200: 353 - ir_baud = USB_IRDA_BR_115200; 353 + ir_baud = USB_IRDA_LS_115200; 354 354 break; 355 355 case 576000: 356 - ir_baud = USB_IRDA_BR_576000; 356 + ir_baud = USB_IRDA_LS_576000; 357 357 break; 358 358 case 1152000: 359 - ir_baud = USB_IRDA_BR_1152000; 359 + ir_baud = USB_IRDA_LS_1152000; 360 360 break; 361 361 case 4000000: 362 - ir_baud = USB_IRDA_BR_4000000; 362 + ir_baud = USB_IRDA_LS_4000000; 363 363 break; 364 364 default: 365 - ir_baud = USB_IRDA_BR_9600; 365 + ir_baud = USB_IRDA_LS_9600; 366 366 baud = 9600; 367 367 } 368 368
+12 -1
include/linux/usb/irda.h
··· 119 119 * 6 - 115200 bps 120 120 * 7 - 576000 bps 121 121 * 8 - 1.152 Mbps 122 - * 9 - 5 mbps 122 + * 9 - 4 Mbps 123 123 * 10..15 - Reserved 124 124 */ 125 125 #define USB_IRDA_STATUS_LINK_SPEED 0x0f 126 + 127 + #define USB_IRDA_LS_NO_CHANGE 0 128 + #define USB_IRDA_LS_2400 1 129 + #define USB_IRDA_LS_9600 2 130 + #define USB_IRDA_LS_19200 3 131 + #define USB_IRDA_LS_38400 4 132 + #define USB_IRDA_LS_57600 5 133 + #define USB_IRDA_LS_115200 6 134 + #define USB_IRDA_LS_576000 7 135 + #define USB_IRDA_LS_1152000 8 136 + #define USB_IRDA_LS_4000000 9 126 137 127 138 /* The following is a 4-bit value used only for 128 139 * outbound header: