2 * This file is part of the libsigrok project.
4 * Copyright (C) 2017-2019 Gerhard Sittig <gerhard.sittig@gmx.net>
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef LIBSIGROK_SERIAL_HID_H
21 #define LIBSIGROK_SERIAL_HID_H
23 /* The prefix for port names which are HID based. */
24 #define SER_HID_CONN_PREFIX "hid"
25 #define SER_HID_USB_PREFIX "usb="
26 #define SER_HID_RAW_PREFIX "raw="
27 #define SER_HID_IOKIT_PREFIX "iokit="
28 #define SER_HID_SNR_PREFIX "sn="
31 * The maximum number of bytes any supported HID chip can communicate
32 * within a single request.
34 * Brymen BU-86X: up to 8 bytes
35 * SiLabs CP2110: up to 63 bytes
36 * Victor DMM: up to 14 bytes
37 * WCH CH9325: up to 7 bytes
39 #define SER_HID_CHUNK_SIZE 64
42 * Routines to get/set reports/data, provided by serial_hid.c and used
43 * in serial_hid_<chip>.c files.
45 SR_PRIV int ser_hid_hidapi_get_report(struct sr_serial_dev_inst *serial,
46 uint8_t *data, size_t len);
47 SR_PRIV int ser_hid_hidapi_set_report(struct sr_serial_dev_inst *serial,
48 const uint8_t *data, size_t len);
49 SR_PRIV int ser_hid_hidapi_get_data(struct sr_serial_dev_inst *serial,
50 uint8_t ep, uint8_t *data, size_t len, int timeout);
51 SR_PRIV int ser_hid_hidapi_set_data(struct sr_serial_dev_inst *serial,
52 uint8_t ep, const uint8_t *data, size_t len, int timeout);