summaryrefslogtreecommitdiff
path: root/src/kernel
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2016-03-02 13:54:58 -0800
committerKeith Packard <keithp@keithp.com>2016-03-02 13:59:21 -0800
commit05fcb717bfc44aba3c1cfd43281e323505a46402 (patch)
treea27b543f7a6f65b87fec29e77ca4151e0c1ee59d /src/kernel
parent05354b8fee6a9af05d66bb7f4761f597da038fdd (diff)
altos/chaoskey: Add another USB endpoint to read raw data
This replaces having the single output switch based on a pin value and allows us to box the device and still fetch raw data. For now, this will use a special libusb2 program, ao-chaosread, to pull bits as I haven't figure out how to make linux provide two /dev entries for one USB device. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/kernel')
-rw-r--r--src/kernel/ao_product.c14
-rw-r--r--src/kernel/ao_usb.h5
2 files changed, 17 insertions, 2 deletions
diff --git a/src/kernel/ao_product.c b/src/kernel/ao_product.c
index 4769d86e..3a829b3a 100644
--- a/src/kernel/ao_product.c
+++ b/src/kernel/ao_product.c
@@ -54,7 +54,7 @@ const char ao_product[] = AO_iProduct_STRING;
#define HEADER_LEN 9
#define CONTROL_CLASS_LEN 35
-#define DATA_LEN (9 + 7 * AO_USB_HAS_OUT + 7 * AO_USB_HAS_IN)
+#define DATA_LEN (9 + 7 * AO_USB_HAS_OUT + 7 * AO_USB_HAS_IN + 7 * AO_USB_HAS_IN2)
#define TOTAL_LENGTH (HEADER_LEN + AO_USB_HAS_INT * CONTROL_CLASS_LEN + DATA_LEN)
#define NUM_INTERFACES (AO_USB_HAS_INT + 1)
@@ -140,7 +140,7 @@ AO_ROMCONFIG_SYMBOL(0x00aa) uint8_t ao_usb_descriptors [] =
AO_USB_DESC_INTERFACE,
AO_USB_HAS_INT, /* bInterfaceNumber */
0x00, /* bAlternateSetting */
- AO_USB_HAS_OUT + AO_USB_HAS_IN, /* bNumEndPoints */
+ AO_USB_HAS_OUT + AO_USB_HAS_IN + AO_USB_HAS_IN2, /* bNumEndPoints */
AO_USB_INTERFACE_CLASS_DATA, /* bInterfaceClass = data */
0x00, /* bInterfaceSubClass */
0x00, /* bInterfaceProtocol */
@@ -166,6 +166,16 @@ AO_ROMCONFIG_SYMBOL(0x00aa) uint8_t ao_usb_descriptors [] =
0x00, /* bInterval */
#endif
+#if AO_USB_HAS_IN2
+ /* Data EP in 2 */
+ 0x07,
+ AO_USB_DESC_ENDPOINT,
+ AO_USB_IN2_EP|0x80, /* bEndpointAddress */
+ 0x02, /* bmAttributes = bulk */
+ LE_WORD(AO_USB_IN_SIZE),/* wMaxPacketSize */
+ 0x00, /* bInterval */
+#endif
+
/* String descriptors */
0x04,
AO_USB_DESC_STRING,
diff --git a/src/kernel/ao_usb.h b/src/kernel/ao_usb.h
index 773b5cb7..8f3e7813 100644
--- a/src/kernel/ao_usb.h
+++ b/src/kernel/ao_usb.h
@@ -105,6 +105,7 @@ extern __code __at (0x00aa) uint8_t ao_usb_descriptors [];
#ifndef AO_USB_OUT_EP
#define AO_USB_OUT_EP 4
#define AO_USB_IN_EP 5
+#define AO_USB_IN2_EP 6
#endif
#ifndef AO_USB_HAS_OUT
@@ -119,6 +120,10 @@ extern __code __at (0x00aa) uint8_t ao_usb_descriptors [];
#define AO_USB_HAS_INT 1
#endif
+#ifndef AO_USB_HAS_IN2
+#define AO_USB_HAS_IN2 0
+#endif
+
/*
* USB bulk packets can only come in 8, 16, 32 and 64
* byte sizes, so we'll use 64 for everything