Skip to content

Commit

Permalink
Merge pull request #119 from sgouraud/baudrate-enhancement
Browse files Browse the repository at this point in the history
Add support for additional baud rate 57600
  • Loading branch information
sidcha committed Jun 14, 2023
2 parents cb0bbaf + 4bcfd2d commit 6dc2e4a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion doc/protocol/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Signaling
---------

Half duplex asynchronous serial 8 data bits, 1 stop bit, no parity bits, with
either one of 9600, 19200, 38400, 115200 or 230400 baud rates.
either one of 9600, 19200, 38400, 57600, 115200 or 230400 baud rates.

Character Encoding
------------------
Expand Down
4 changes: 2 additions & 2 deletions include/osdp.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ struct osdp_channel {
* @brief OSDP PD Information. This struct is used to describe a PD to LibOSDP.
*
* @param name User provided name for this PD (log messages include this name)
* @param baud_rate Can be one of 9600/19200/38400/115200/230400
* @param baud_rate Can be one of 9600/19200/38400/57600/115200/230400
* @param address 7 bit PD address. the rest of the bits are ignored. The
* special address 0x7F is used for broadcast. So there can be 2^7-1
* devices on a multi-drop channel
Expand Down Expand Up @@ -462,7 +462,7 @@ struct osdp_cmd_text {
*
* @param address Unit ID to which this PD will respond after the change takes
* effect.
* @param baud_rate baud rate value 9600/19200/38400/115200/230400
* @param baud_rate baud rate value 9600/19200/38400/57600/115200/230400
*/
struct osdp_cmd_comset {
uint8_t address;
Expand Down
4 changes: 2 additions & 2 deletions osdpctl/cmd_send.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ int handle_cmd_comset(int argc, char *argv[], struct osdp_cmd_comset *c)
if (address <= 0 || address >= 126)
return -1;

if (baud != 9600 && baud != 19200 && baud != 38400 && baud != 115200 &&
baud != 230400)
if (baud != 9600 && baud != 19200 && baud != 38400 && baud != 57600 &&
baud != 115200 && baud != 230400)
return -1;

c->address = (uint8_t)address;
Expand Down
4 changes: 2 additions & 2 deletions osdpctl/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ int config_parse_key_channel_speed(const char *val, void *data)
if (safe_atoi(val, &baud))
return INI_FAILURE;

if (baud != 9600 && baud != 19200 && baud != 38400 && baud != 115200 &&
baud != 230400) {
if (baud != 9600 && baud != 19200 && baud != 38400 && baud != 57600 &&
baud != 115200 && baud != 230400) {
printf("Error: invalid baudrate %d\n", baud);
return INI_FAILURE;
}
Expand Down
1 change: 1 addition & 0 deletions src/osdp_pd.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,7 @@ static int pd_decode_command(struct osdp_pd *pd, uint8_t *buf, int len)
(cmd.comset.baud_rate != 9600 &&
cmd.comset.baud_rate != 19200 &&
cmd.comset.baud_rate != 38400 &&
cmd.comset.baud_rate != 57600 &&
cmd.comset.baud_rate != 115200 &&
cmd.comset.baud_rate != 230400)) {
LOG_ERR("COMSET Failed! command discarded");
Expand Down

0 comments on commit 6dc2e4a

Please sign in to comment.