Skip to content

Commit 17a0184

Browse files
committed
USB: serial: ir-usb: fix link-speed handling
Commit e0d795e ("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: e0d795e ("usb: irda: cleanup on ir-usb module") Cc: stable <[email protected]> # 2.6.27 Cc: Felipe Balbi <[email protected]> Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
1 parent 2988a8a commit 17a0184

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

drivers/usb/serial/ir-usb.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -335,34 +335,34 @@ static void ir_set_termios(struct tty_struct *tty,
335335

336336
switch (baud) {
337337
case 2400:
338-
ir_baud = USB_IRDA_BR_2400;
338+
ir_baud = USB_IRDA_LS_2400;
339339
break;
340340
case 9600:
341-
ir_baud = USB_IRDA_BR_9600;
341+
ir_baud = USB_IRDA_LS_9600;
342342
break;
343343
case 19200:
344-
ir_baud = USB_IRDA_BR_19200;
344+
ir_baud = USB_IRDA_LS_19200;
345345
break;
346346
case 38400:
347-
ir_baud = USB_IRDA_BR_38400;
347+
ir_baud = USB_IRDA_LS_38400;
348348
break;
349349
case 57600:
350-
ir_baud = USB_IRDA_BR_57600;
350+
ir_baud = USB_IRDA_LS_57600;
351351
break;
352352
case 115200:
353-
ir_baud = USB_IRDA_BR_115200;
353+
ir_baud = USB_IRDA_LS_115200;
354354
break;
355355
case 576000:
356-
ir_baud = USB_IRDA_BR_576000;
356+
ir_baud = USB_IRDA_LS_576000;
357357
break;
358358
case 1152000:
359-
ir_baud = USB_IRDA_BR_1152000;
359+
ir_baud = USB_IRDA_LS_1152000;
360360
break;
361361
case 4000000:
362-
ir_baud = USB_IRDA_BR_4000000;
362+
ir_baud = USB_IRDA_LS_4000000;
363363
break;
364364
default:
365-
ir_baud = USB_IRDA_BR_9600;
365+
ir_baud = USB_IRDA_LS_9600;
366366
baud = 9600;
367367
}
368368

include/linux/usb/irda.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,22 @@ struct usb_irda_cs_descriptor {
119119
* 6 - 115200 bps
120120
* 7 - 576000 bps
121121
* 8 - 1.152 Mbps
122-
* 9 - 5 mbps
122+
* 9 - 4 Mbps
123123
* 10..15 - Reserved
124124
*/
125125
#define USB_IRDA_STATUS_LINK_SPEED 0x0f
126126

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
137+
127138
/* The following is a 4-bit value used only for
128139
* outbound header:
129140
*

0 commit comments

Comments
 (0)