aboutsummaryrefslogtreecommitdiff
path: root/usb.h
diff options
context:
space:
mode:
Diffstat (limited to 'usb.h')
-rw-r--r--usb.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/usb.h b/usb.h
new file mode 100644
index 0000000..d8e156e
--- /dev/null
+++ b/usb.h
@@ -0,0 +1,47 @@
+/*
+ * CHU - driver for CH375 in disk mode
+ * Copyright (C) 2024 Javier S. Pedro
+ *
+ * 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 <https://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef USB_H
+#define USB_H
+
+#include <stdint.h>
+
+typedef enum usb_descriptor_type {
+ USB_DESCRIPTOR_TYPE_DEVICE = 1,
+ USB_DESCRIPTOR_TYPE_CONFIG = 2
+} usb_descriptor_type;
+
+typedef _Packed struct usb_device_descriptor {
+ uint8_t bLength;
+ uint8_t bDescriptorType;
+ uint16_t bcdUSB;
+ uint8_t bDeviceClass;
+ uint8_t bDeviceSubClass;
+ uint8_t bDeviceProtocol;
+ uint8_t bMaxPacketSize0;
+ uint16_t idVendor;
+ uint16_t idProduct;
+ uint16_t bcdDevice;
+ uint8_t iManufacturer;
+ uint8_t iProduct;
+ uint8_t iSerialNumber;
+ uint8_t bNumConfigurations;
+} usb_device_descriptor;
+
+#endif // USB_H