return SR_ERR;
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;
- case 57600:
- dcb.BaudRate = CBR_57600;
+ case 300:
+ dcb.BaudRate = CBR_300;
break;
- case 38400:
- dcb.BaudRate = CBR_38400;
+ case 600:
+ dcb.BaudRate = CBR_600;
break;
- case 19200:
- dcb.BaudRate = CBR_19200;
+ case 1200:
+ dcb.BaudRate = CBR_1200;
break;
- case 9600:
- dcb.BaudRate = CBR_9600;
+ case 2400:
+ dcb.BaudRate = CBR_2400;
break;
case 4800:
dcb.BaudRate = CBR_4800;
break;
- case 2400:
- dcb.BaudRate = CBR_2400;
+ 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:
- sr_err("Unsupported baudrate %d.", baudrate);
+ sr_err("Unsupported baudrate: %d.", baudrate);
return SR_ERR;
}
+ sr_spew("Configuring baudrate to %d (%d).", baudrate, dcb.BaudRate);
+
dcb.ByteSize = bits;
dcb.Parity = NOPARITY; /* TODO: Don't hardcode. */
dcb.StopBits = ONESTOPBIT; /* TODO: Don't hardcode. */
break;
#endif
default:
- sr_err("Unsupported baudrate %d.", baudrate);
+ sr_err("Unsupported baudrate: %d.", baudrate);
return SR_ERR;
}