X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fdcttech-usbrelay%2Fprotocol.h;h=9e3d86df115534e80f9e13ebf70e0cd67492c046;hb=6ee37801751a6e76e6b5865d1b3c88b9d342fe53;hp=519518426fd69af9960825857fad8a9c446e37c1;hpb=64d54a719aed9204091b8d88c1b881f1341f0592;p=libsigrok.git diff --git a/src/hardware/dcttech-usbrelay/protocol.h b/src/hardware/dcttech-usbrelay/protocol.h index 51951842..9e3d86df 100644 --- a/src/hardware/dcttech-usbrelay/protocol.h +++ b/src/hardware/dcttech-usbrelay/protocol.h @@ -20,16 +20,44 @@ #ifndef LIBSIGROK_HARDWARE_DCTTECH_USBRELAY_PROTOCOL_H #define LIBSIGROK_HARDWARE_DCTTECH_USBRELAY_PROTOCOL_H -#include #include +#include #include +#include + #include "libsigrok-internal.h" #define LOG_PREFIX "dcttech-usbrelay" +/* USB identification. */ +#define VENDOR_ID 0x16c0 +#define PRODUCT_ID 0x05df +#define VENDOR_STRING "www.dcttech.com" +#define PRODUCT_STRING_PREFIX "USBRelay" + +/* HID report layout. */ +#define REPORT_NUMBER 0 +#define REPORT_BYTECOUNT 8 +#define SERNO_LENGTH 5 +#define STATE_INDEX 7 + struct dev_context { + char *hid_path; + uint16_t usb_vid, usb_pid; + hid_device *hid_dev; + size_t relay_count; + uint32_t relay_mask; + uint32_t relay_state; +}; + +struct channel_group_context { + size_t number; }; -SR_PRIV int dcttech_usbrelay_receive_data(int fd, int revents, void *cb_data); +SR_PRIV int dcttech_usbrelay_update_state(const struct sr_dev_inst *sdi); +SR_PRIV int dcttech_usbrelay_switch_cg(const struct sr_dev_inst *sdi, + const struct sr_channel_group *cg, gboolean on); +SR_PRIV int dcttech_usbrelay_query_cg(const struct sr_dev_inst *sdi, + const struct sr_channel_group *cg, gboolean *on); #endif