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
335 335
336 switch (baud) {336 switch (baud) {
337 case 2400:337 case 2400:
338 ir_baud = USB_IRDA_BR_2400;338 ir_baud = USB_IRDA_LS_2400;
339 break;339 break;
340 case 9600:340 case 9600:
341 ir_baud = USB_IRDA_BR_9600;341 ir_baud = USB_IRDA_LS_9600;
342 break;342 break;
343 case 19200:343 case 19200:
344 ir_baud = USB_IRDA_BR_19200;344 ir_baud = USB_IRDA_LS_19200;
345 break;345 break;
346 case 38400:346 case 38400:
347 ir_baud = USB_IRDA_BR_38400;347 ir_baud = USB_IRDA_LS_38400;
348 break;348 break;
349 case 57600:349 case 57600:
350 ir_baud = USB_IRDA_BR_57600;350 ir_baud = USB_IRDA_LS_57600;
351 break;351 break;
352 case 115200:352 case 115200:
353 ir_baud = USB_IRDA_BR_115200;353 ir_baud = USB_IRDA_LS_115200;
354 break;354 break;
355 case 576000:355 case 576000:
356 ir_baud = USB_IRDA_BR_576000;356 ir_baud = USB_IRDA_LS_576000;
357 break;357 break;
358 case 1152000:358 case 1152000:
359 ir_baud = USB_IRDA_BR_1152000;359 ir_baud = USB_IRDA_LS_1152000;
360 break;360 break;
361 case 4000000:361 case 4000000:
362 ir_baud = USB_IRDA_BR_4000000;362 ir_baud = USB_IRDA_LS_4000000;
363 break;363 break;
364 default:364 default:
365 ir_baud = USB_IRDA_BR_9600;365 ir_baud = USB_IRDA_LS_9600;
366 baud = 9600;366 baud = 9600;
367 }367 }
368 368
include/linux/usb/irda.h+12−1
@@ -119,11 +119,22 @@ struct usb_irda_cs_descriptor { · 118 unmodified lines
119 * 6 - 115200 bps119 * 6 - 115200 bps
120 * 7 - 576000 bps120 * 7 - 576000 bps
121 * 8 - 1.152 Mbps121 * 8 - 1.152 Mbps
122 * 9 - 5 mbps122 * 9 - 4 Mbps
123 * 10..15 - Reserved123 * 10..15 - Reserved
124 */124 */
125#define USB_IRDA_STATUS_LINK_SPEED 0x0f125#define USB_IRDA_STATUS_LINK_SPEED 0x0f
126 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
137
127/* The following is a 4-bit value used only for138/* The following is a 4-bit value used only for
128 * outbound header:139 * outbound header:
129 *140 *

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