From: Uwe Hermann Date: Tue, 3 Apr 2018 10:23:02 +0000 (+0200) Subject: zketech-ebd-usb: Add some underscores to #defines. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=ec4806dcf5d21d159a81a21aaee3af1b086211f2;p=libsigrok.git zketech-ebd-usb: Add some underscores to #defines. --- diff --git a/src/hardware/zketech-ebd-usb/api.c b/src/hardware/zketech-ebd-usb/api.c index cb59292e..4db306f6 100644 --- a/src/hardware/zketech-ebd-usb/api.c +++ b/src/hardware/zketech-ebd-usb/api.c @@ -43,7 +43,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) const char *conn, *serialcomm; struct sr_config *src; struct sr_serial_dev_inst *serial; - uint8_t reply[MSGLEN]; + uint8_t reply[MSG_LEN]; conn = NULL; serialcomm = NULL; @@ -89,9 +89,9 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) /* Starting device. */ zketech_ebd_usb_init(serial, devc); - int ret = zketech_ebd_usb_read_chars(serial, MSGLEN, reply); - if (ret != MSGLEN || reply[MSGFRAMEBEGINPOS] != MSGFRAMEBEGIN \ - || reply[MSGFRAMEENDPOS] != MSGFRAMEEND) { + int ret = zketech_ebd_usb_read_chars(serial, MSG_LEN, reply); + if (ret != MSG_LEN || reply[MSG_FRAME_BEGIN_POS] != MSG_FRAME_BEGIN \ + || reply[MSG_FRAME_END_POS] != MSG_FRAME_END) { sr_warn("Invalid message received!"); ret = SR_ERR; } diff --git a/src/hardware/zketech-ebd-usb/protocol.c b/src/hardware/zketech-ebd-usb/protocol.c index 926a4314..fe861452 100644 --- a/src/hardware/zketech-ebd-usb/protocol.c +++ b/src/hardware/zketech-ebd-usb/protocol.c @@ -187,11 +187,11 @@ SR_PRIV int zketech_ebd_usb_receive_data(int fd, int revents, void *cb_data) serial = sdi->conn; - uint8_t reply[MSGLEN]; - int ret = zketech_ebd_usb_read_chars(serial, MSGLEN, reply); + uint8_t reply[MSG_LEN]; + int ret = zketech_ebd_usb_read_chars(serial, MSG_LEN, reply); /* Tests for correct message. */ - if (ret != MSGLEN) { + if (ret != MSG_LEN) { sr_err("Message invalid [Len]."); return (ret < 0) ? ret : SR_ERR; } @@ -201,9 +201,9 @@ SR_PRIV int zketech_ebd_usb_receive_data(int fd, int revents, void *cb_data) reply[9] ^ reply[10] ^ reply[11] ^ reply[12] ^ \ reply[13] ^ reply[14] ^ reply[15] ^ reply[16]; - if (reply[MSGFRAMEBEGINPOS] != MSGFRAMEBEGIN || \ - reply[MSGFRAMEENDPOS] != MSGFRAMEEND || \ - xor != reply[MSGCHECKSUMPOS]) { + if (reply[MSG_FRAME_BEGIN_POS] != MSG_FRAME_BEGIN || \ + reply[MSG_FRAME_END_POS] != MSG_FRAME_END || \ + xor != reply[MSG_CHECKSUM_POS]) { sr_err("Message invalid [XOR, BEGIN/END]."); return SR_ERR; } diff --git a/src/hardware/zketech-ebd-usb/protocol.h b/src/hardware/zketech-ebd-usb/protocol.h index 9f750b77..a15282a7 100644 --- a/src/hardware/zketech-ebd-usb/protocol.h +++ b/src/hardware/zketech-ebd-usb/protocol.h @@ -27,12 +27,12 @@ #define LOG_PREFIX "zketech-ebd-usb" -#define MSGLEN 19 -#define MSGCHECKSUMPOS 17 -#define MSGFRAMEBEGIN 0xfa -#define MSGFRAMEBEGINPOS 0 -#define MSGFRAMEEND 0xf8 -#define MSGFRAMEENDPOS 18 +#define MSG_LEN 19 +#define MSG_CHECKSUM_POS 17 +#define MSG_FRAME_BEGIN 0xfa +#define MSG_FRAME_BEGIN_POS 0 +#define MSG_FRAME_END 0xf8 +#define MSG_FRAME_END_POS 18 struct dev_context { struct sr_sw_limits limits;