Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for additional baud rate 57600 #119

Merged
merged 2 commits into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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