1 /* 2 * This file is part of the libsigrok project. 3 * 4 * Copyright (C) 2017-2019 Gerhard Sittig <gerhard.sittig@gmx.net> 5 * 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. 10 * 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. 15 * 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/>. 18 */ 19 20 #ifndef LIBSIGROK_SERIAL_HID_H 21 #define LIBSIGROK_SERIAL_HID_H 22 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_SNR_PREFIX "sn=" 28 29 /* 30 * The maximum number of bytes any supported HID chip can communicate 31 * within a single request. 32 * 33 * Brymen BU-86X: up to 8 bytes 34 * SiLabs CP2110: up to 63 bytes 35 * Victor DMM: up to 14 bytes 36 * WCH CH9325: up to 7 bytes 37 */ 38 #define SER_HID_CHUNK_SIZE 64 39 40 /* 41 * Routines to get/set reports/data, provided by serial_hid.c and used 42 * in serial_hid_<chip>.c files. 43 */ 44 SR_PRIV int ser_hid_hidapi_get_report(struct sr_serial_dev_inst *serial, 45 uint8_t *data, size_t len); 46 SR_PRIV int ser_hid_hidapi_set_report(struct sr_serial_dev_inst *serial, 47 const uint8_t *data, size_t len); 48 SR_PRIV int ser_hid_hidapi_get_data(struct sr_serial_dev_inst *serial, 49 uint8_t ep, uint8_t *data, size_t len, int timeout); 50 SR_PRIV int ser_hid_hidapi_set_data(struct sr_serial_dev_inst *serial, 51 uint8_t ep, const uint8_t *data, size_t len, int timeout); 52 53 #endif 54