8000 Modified to add flag to build with XAC · ATMakersBill/circuitpython@6b1509d · GitHub
[go: up one dir, main page]

Skip to content

Commit 6b1509d

Browse files
committed
Modified to add flag to build with XAC
1 parent 03f9048 commit 6b1509d

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed

supervisor/supervisor.mk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ ifneq ($(SPI_FLASH_FILESYSTEM),)
2828
CFLAGS += -DSPI_FLASH_FILESYSTEM=$(SPI_FLASH_FILESYSTEM) -DEXPRESS_BOARD
2929
endif
3030

31+
# If HID_CONFIG is not set, set it to standard. This is stop-gap to support the XAC
32+
ifeq ($(HID_CONFIG),)
33+
HID_CONFIG = standard
34+
endif
35+
3136
# Choose which flash filesystem impl to use.
3237
# (Right now INTERNAL_FLASH_FILESYSTEM and SPI_FLASH_FILESYSTEM are mutually exclusive.
3338
# But that might not be true in the future.)
@@ -93,6 +98,7 @@ autogen_usb_descriptor.intermediate: ../../tools/gen_usb_descriptor.py Makefile
9398
$(STEPECHO) "GEN $@"
9499
$(Q)install -d $(BUILD)/genhdr
95100
$(Q)$(PYTHON3) ../../tools/gen_usb_descriptor.py \
101+
--hid_config $(HID_CONFIG) \
96102
--manufacturer $(USB_MANUFACTURER)\
97103
--product $(USB_PRODUCT)\
98104
--vid $(USB_VID)\

tools/gen_usb_descriptor.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import hid_report_descriptors
1010

1111
parser = argparse.ArgumentParser(description='Generate USB descriptors.')
12+
parser.add_argument('--hid_config', type=str,
13+
help='standard HID or XAC')
1214
parser.add_argument('--manufacturer', type=str,
1315
help='manufacturer of the device')
1416
parser.add_argument('--product', type=str,
@@ -140,7 +142,10 @@ def strings_in_order(cls):
140142

141143
# Include only these HID devices.
142144
# DIGITIZER works on Linux but conflicts with MOUSE, so leave it out for now.
143-
hid_devices = ("KEYBOARD", "MOUSE", "CONSUMER", "GAMEPAD")
145+
if (args.hid_config == "XAC"):
146+
hid_devices = ("XAC",)
147+
else:
148+
hid_devices = ("KEYBOARD", "MOUSE", "CONSUMER", "GAMEPAD")
144149

145150
combined_hid_report_descriptor = hid.ReportDescriptor(
146151
description="MULTIDEVICE",

tools/hid_report_descriptors.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"SYS_CONTROL" : 4,
3939
"GAMEPAD" : 5,
4040
"DIGITIZER" : 6,
41+
"XAC" : 7,
4142
}
4243

4344
# Byte count for each kind of report. Length does not include report ID in first byte.
@@ -48,6 +49,7 @@
4849
"SYS_CONTROL" : 1,
4950
"GAMEPAD" : 6,
5051
"DIGITIZER" : 5,
52+
"XAC" : 6
5153
}
5254

5355
KEYBOARD_WITH_ID = hid.ReportDescriptor(
@@ -194,6 +196,35 @@
194196
0xC0, # End Collection
195197
]))
196198

199+
XAC_WITH_ID = hid.ReportDescriptor(
200+
description="XAC",
201+
report_descriptor=bytes([
202+
# This descriptor mimics the simple joystick from PDP that the XBox likes
203+
0x05, 0x01, # Usage Page (Desktop),
204+
0x09, 0x05, # Usage (Gamepad),
205+
0xA1, 0x01, # Collection (Application),
206+
0x85, REPORT_IDS["XAC"], # Report ID (n)
207+
0x15, 0x00, # Logical Minimum (0),
208+
0x25, 0x01, # Logical Maximum (1),
209+
0x35, 0x00, # Physical Minimum (0),
210+
0x45, 0x01, # Physical Maximum (1),
211+
0x75, 0x01, # Report Size (1),
212+
0x95, 0x08, # Report Count (8),
213+
0x05, 0x09, # Usage Page (Button),
214+
0x19, 0x01, # Usage Minimum (01h),
215+
0x29, 0x08, # Usage Maximum (08h),
216+
0x81, 0x02, # Input (Variable),
217+
0x05, 0x01, # Usage Page (Desktop),
218+
0x26, 0xFF, 0x00, # Logical Maximum (255),
219+
0x46, 0xFF, 0x00, # Physical Maximum (255),
220+
0x09, 0x30, # Usage (X),
221+
0x09, 0x31, # Usage (Y),
222+
0x75, 0x08, # Report Size (8),
223+
0x95, 0x02, # Report Count (2),
224+
0x81, 0x02, # Input (Variable),
225+
0xC0 # End Collection
226+
]))
227+
197228
DIGITIZER_WITH_ID = hid.ReportDescriptor(
198229
description="DIGITIZER",
199230
report_descriptor=bytes([
@@ -236,4 +267,5 @@
236267
"SYS_CONTROL" : SYS_CONTROL_WITH_ID,
237268
"GAMEPAD" : GAMEPAD_WITH_ID,
238269
"DIGITIZER" : DIGITIZER_WITH_ID,
270+
"XAC" : XAC_WITH_ID,
239271
}

0 commit comments

Comments
 (0)
0