History

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).

Johan Hovold committed 6 years ago

Commit 17a01841 parent 2988a8a2 files · +22 −11Browse files

Unified · Split

2 files
  1. drivers/usb/serial/ir-usb.c +10 −10
  2. include/linux/usb/irda.h +12 −1
drivers/usb/serial/ir-usb.c+10−10
@@ -335,34 +335,34 @@ static void ir_set_termios(struct tty_struct *tty, · 334 unmodified lines
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+12−1
@@ -119,11 +119,22 @@ struct usb_irda_cs_descriptor { · 118 unmodified lines
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 *

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t