X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fserial_hid.h;fp=src%2Fserial_hid.h;h=d147978667b307c11438ccbbef625629ae38cc68;hb=edec0436db2a73b545f5d4db0c1635d6c67ff45c;hp=0000000000000000000000000000000000000000;hpb=4417074c68ce998c2d666fc8a034204a1b74fc2f;p=libsigrok.git diff --git a/src/serial_hid.h b/src/serial_hid.h new file mode 100644 index 00000000..d1479786 --- /dev/null +++ b/src/serial_hid.h @@ -0,0 +1,51 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2017-2019 Gerhard Sittig + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef SERIAL_HID_H +#define SERIAL_HID_H + +/* The prefix for port names which are HID based. */ +#define SER_HID_CONN_PREFIX "hid" +#define SER_HID_USB_PREFIX "usb=" +#define SER_HID_RAW_PREFIX "raw=" +#define SER_HID_SNR_PREFIX "sn=" + +/* + * The maximum number of bytes any supported HID chip can communicate + * within a single request. + * + * CP2110: up to 63bytes + * CH9325: up to 7 bytes + */ +#define SER_HID_CHUNK_SIZE 64 + +/* + * Routines to get/set reports/data, provided by serial_hid.c and used + * in serial_hid_.c files. + */ +SR_PRIV int ser_hid_hidapi_get_report(struct sr_serial_dev_inst *serial, + uint8_t *data, size_t len); +SR_PRIV int ser_hid_hidapi_set_report(struct sr_serial_dev_inst *serial, + const uint8_t *data, size_t len); +SR_PRIV int ser_hid_hidapi_get_data(struct sr_serial_dev_inst *serial, + uint8_t ep, uint8_t *data, size_t len, int timeout); +SR_PRIV int ser_hid_hidapi_set_data(struct sr_serial_dev_inst *serial, + uint8_t ep, const uint8_t *data, size_t len, int timeout); + +#endif