serial: Full baudrate support on Windows/MinGW.
This commit is contained in:
parent
39e5d79826
commit
5ae35c29a7
|
@ -329,31 +329,58 @@ SR_PRIV int serial_set_params(struct sr_serial_dev_inst *serial, int baudrate,
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
|
|
||||||
switch (baudrate) {
|
switch (baudrate) {
|
||||||
case 115200:
|
/*
|
||||||
dcb.BaudRate = CBR_115200;
|
* The baudrates 50/75/134/150/200/1800/230400/460800 do not seem to
|
||||||
|
* have documented CBR_* macros.
|
||||||
|
*/
|
||||||
|
case 110:
|
||||||
|
dcb.BaudRate = CBR_110;
|
||||||
break;
|
break;
|
||||||
case 57600:
|
case 300:
|
||||||
dcb.BaudRate = CBR_57600;
|
dcb.BaudRate = CBR_300;
|
||||||
break;
|
break;
|
||||||
case 38400:
|
case 600:
|
||||||
dcb.BaudRate = CBR_38400;
|
dcb.BaudRate = CBR_600;
|
||||||
break;
|
break;
|
||||||
case 19200:
|
case 1200:
|
||||||
dcb.BaudRate = CBR_19200;
|
dcb.BaudRate = CBR_1200;
|
||||||
break;
|
|
||||||
case 9600:
|
|
||||||
dcb.BaudRate = CBR_9600;
|
|
||||||
break;
|
|
||||||
case 4800:
|
|
||||||
dcb.BaudRate = CBR_4800;
|
|
||||||
break;
|
break;
|
||||||
case 2400:
|
case 2400:
|
||||||
dcb.BaudRate = CBR_2400;
|
dcb.BaudRate = CBR_2400;
|
||||||
break;
|
break;
|
||||||
|
case 4800:
|
||||||
|
dcb.BaudRate = CBR_4800;
|
||||||
|
break;
|
||||||
|
case 9600:
|
||||||
|
dcb.BaudRate = CBR_9600;
|
||||||
|
break;
|
||||||
|
case 14400:
|
||||||
|
dcb.BaudRate = CBR_14400; /* Not available on Unix? */
|
||||||
|
break;
|
||||||
|
case 19200:
|
||||||
|
dcb.BaudRate = CBR_19200;
|
||||||
|
break;
|
||||||
|
case 38400:
|
||||||
|
dcb.BaudRate = CBR_38400;
|
||||||
|
break;
|
||||||
|
case 57600:
|
||||||
|
dcb.BaudRate = CBR_57600;
|
||||||
|
break;
|
||||||
|
case 115200:
|
||||||
|
dcb.BaudRate = CBR_115200;
|
||||||
|
break;
|
||||||
|
case 128000:
|
||||||
|
dcb.BaudRate = CBR_128000; /* Not available on Unix? */
|
||||||
|
break;
|
||||||
|
case 256000:
|
||||||
|
dcb.BaudRate = CBR_256000; /* Not available on Unix? */
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
sr_err("Unsupported baudrate %d.", baudrate);
|
sr_err("Unsupported baudrate: %d.", baudrate);
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
}
|
}
|
||||||
|
sr_spew("Configuring baudrate to %d (%d).", baudrate, dcb.BaudRate);
|
||||||
|
|
||||||
dcb.ByteSize = bits;
|
dcb.ByteSize = bits;
|
||||||
dcb.Parity = NOPARITY; /* TODO: Don't hardcode. */
|
dcb.Parity = NOPARITY; /* TODO: Don't hardcode. */
|
||||||
dcb.StopBits = ONESTOPBIT; /* TODO: Don't hardcode. */
|
dcb.StopBits = ONESTOPBIT; /* TODO: Don't hardcode. */
|
||||||
|
@ -448,7 +475,7 @@ SR_PRIV int serial_set_params(struct sr_serial_dev_inst *serial, int baudrate,
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
sr_err("Unsupported baudrate %d.", baudrate);
|
sr_err("Unsupported baudrate: %d.", baudrate);
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue