Skip to content

Commit 96d1711

Browse files
committed
Merge remote-tracking branch 'upstream/master' into stm32-ci-workflow
2 parents e92a21c + 296e858 commit 96d1711

7 files changed

Lines changed: 430 additions & 391 deletions

File tree

ports/atmel-samd/mpconfigport.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ ifeq ($(CHIP_FAMILY),samd21)
2020
CIRCUITPY_AUDIOMIXER = 0
2121
CIRCUITPY_FREQUENCYIO = 0
2222
CIRCUITPY_TOUCHIO_USE_NATIVE = 1
23+
24+
# SAMD21 needs separate endpoint pairs for MSC BULK IN and BULK OUT, otherwise it's erratic.
25+
USB_MSC_NUM_ENDPOINT_PAIRS = 2
2326
endif
2427

2528
# Put samd51-only choices here.

shared-module/usb_hid/Device.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ void common_hal_usb_hid_device_send_report(usb_hid_device_obj_t *self, uint8_t*
4848
// Wait until interface is ready, timeout = 2 seconds
4949
uint64_t end_ticks = ticks_ms + 2000;
5050
while ( (ticks_ms < end_ticks) && !tud_hid_ready() ) {
51-
#ifdef MICROPY_VM_HOOK_LOOP
52-
MICROPY_VM_HOOK_LOOP;
53-
#endif
51+
RUN_BACKGROUND_TASKS;
5452
}
5553

5654
if ( !tud_hid_ready() ) {

shared-module/usb_hid/__init__.c

Lines changed: 1 addition & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -24,131 +24,4 @@
2424
* THE SOFTWARE.
2525
*/
2626

27-
#include "py/obj.h"
28-
#include "py/mphal.h"
29-
#include "py/runtime.h"
30-
31-
#include "genhdr/autogen_usb_descriptor.h"
32-
#include "shared-module/usb_hid/Device.h"
33-
#include "shared-bindings/usb_hid/Device.h"
34-
#include "tusb.h"
35-
36-
#ifdef USB_HID_REPORT_ID_KEYBOARD
37-
static uint8_t keyboard_report_buffer[USB_HID_REPORT_LENGTH_KEYBOARD];
38-
#endif
39-
40-
#ifdef USB_HID_REPORT_ID_MOUSE
41-
static uint8_t mouse_report_buffer[USB_HID_REPORT_LENGTH_MOUSE];
42-
#endif
43-
44-
#ifdef USB_HID_REPORT_ID_CONSUMER
45-
static uint8_t consumer_report_buffer[USB_HID_REPORT_LENGTH_CONSUMER];
46-
#endif
47-
48-
#ifdef USB_HID_REPORT_ID_SYS_CONTROL
49-
static uint8_t sys_control_report_buffer[USB_HID_REPORT_LENGTH_SYS_CONTROL];
50-
#endif
51-
52-
#ifdef USB_HID_REPORT_ID_GAMEPAD
53-
static uint8_t gamepad_report_buffer[USB_HID_REPORT_LENGTH_GAMEPAD];
54-
#endif
55-
56-
#ifdef USB_HID_REPORT_ID_DIGITIZER
57-
static uint8_t digitizer_report_buffer[USB_HID_REPORT_LENGTH_DIGITIZER];
58-
#endif
59-
60-
usb_hid_device_obj_t usb_hid_devices[] = {
61-
#ifdef USB_HID_REPORT_ID_KEYBOARD
62-
{
63-
.base = { .type = &usb_hid_device_type } ,
64-
.report_buffer = keyboard_report_buffer ,
65-
.report_id = USB_HID_REPORT_ID_KEYBOARD ,
66-
.report_length = USB_HID_REPORT_LENGTH_KEYBOARD ,
67-
.usage_page = HID_USAGE_PAGE_DESKTOP ,
68-
.usage = HID_USAGE_DESKTOP_KEYBOARD ,
69-
},
70-
#endif
71-
72-
#ifdef USB_HID_REPORT_ID_MOUSE
73-
{
74-
.base = { .type = &usb_hid_device_type } ,
75-
.report_buffer = mouse_report_buffer ,
76-
.report_id = USB_HID_REPORT_ID_MOUSE ,
77-
.report_length = USB_HID_REPORT_LENGTH_MOUSE ,
78-
.usage_page = HID_USAGE_PAGE_DESKTOP ,
79-
.usage = HID_USAGE_DESKTOP_MOUSE ,
80-
},
81-
#endif
82-
83-
#ifdef USB_HID_REPORT_ID_CONSUMER
84-
{
85-
.base = { .type = &usb_hid_device_type } ,
86-
.report_buffer = consumer_report_buffer ,
87-
.report_id = USB_HID_REPORT_ID_CONSUMER ,
88-
.report_length = USB_HID_REPORT_LENGTH_CONSUMER ,
89-
.usage_page = HID_USAGE_PAGE_CONSUMER ,
90-
.usage = HID_USAGE_CONSUMER_CONTROL ,
91-
},
92-
#endif
93-
94-
#ifdef USB_HID_REPORT_ID_SYS_CONTROL
95-
{
96-
.base = { .type = &usb_hid_device_type } ,
97-
.report_buffer = sys_control_report_buffer ,
98-
.report_id = USB_HID_REPORT_ID_SYS_CONTROL ,
99-
.report_length = USB_HID_REPORT_LENGTH_SYS_CONTROL ,
100-
.usage_page = HID_USAGE_PAGE_DESKTOP ,
101-
.usage = HID_USAGE_DESKTOP_SYSTEM_CONTROL ,
102-
},
103-
#endif
104-
105-
#ifdef USB_HID_REPORT_ID_GAMEPAD
106-
{
107-
.base = { .type = &usb_hid_device_type } ,
108-
.report_buffer = gamepad_report_buffer ,
109-
.report_id = USB_HID_REPORT_ID_GAMEPAD ,
110-
.report_length = USB_HID_REPORT_LENGTH_GAMEPAD ,
111-
.usage_page = HID_USAGE_PAGE_DESKTOP ,
112-
.usage = HID_USAGE_DESKTOP_GAMEPAD ,
113-
},
114-
#endif
115-
116-
#ifdef USB_HID_REPORT_ID_DIGITIZER
117-
{
118-
.base = { .type = &usb_hid_device_type } ,
119-
.report_buffer = digitizer_report_buffer ,
120-
.report_id = USB_HID_REPORT_ID_DIGITIZER ,
121-
.report_length = USB_HID_REPORT_LENGTH_DIGITIZER ,
122-
.usage_page = 0x0D ,
123-
.usage = 0x02 ,
124-
},
125-
#endif
126-
};
127-
128-
129-
mp_obj_tuple_t common_hal_usb_hid_devices = {
130-
.base = {
131-
.type = &mp_type_tuple,
132-
},
133-
.len = USB_HID_NUM_DEVICES,
134-
.items = {
135-
#if USB_HID_NUM_DEVICES >= 1
136-
(mp_obj_t) &usb_hid_devices[0],
137-
#endif
138-
#if USB_HID_NUM_DEVICES >= 2
139-
(mp_obj_t) &usb_hid_devices[1],
140-
#endif
141-
#if USB_HID_NUM_DEVICES >= 3
142-
(mp_obj_t) &usb_hid_devices[2],
143-
#endif
144-
#if USB_HID_NUM_DEVICES >= 4
145-
(mp_obj_t) &usb_hid_devices[3],
146-
#endif
147-
#if USB_HID_NUM_DEVICES >= 5
148-
(mp_obj_t) &usb_hid_devices[4],
149-
#endif
150-
#if USB_HID_NUM_DEVICES >= 6
151-
(mp_obj_t) &usb_hid_devices[5],
152-
#endif
153-
}
154-
};
27+
// Nothing needed here. Tables of HID devices are generated in autogen_usb_descriptor.c at compile-time.

supervisor/supervisor.mk

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,19 @@ else
8686
CFLAGS += -DUSB_AVAILABLE
8787
endif
8888

89+
ifndef USB_DEVICES
90+
USB_DEVICES = "CDC,MSC,AUDIO,HID"
91+
endif
92+
93+
ifndef USB_HID_DEVICES
94+
USB_HID_DEVICES = "KEYBOARD,MOUSE,CONSUMER,GAMEPAD"
95+
endif
96+
97+
# SAMD21 needs separate endpoint pairs for MSC BULK IN and BULK OUT, otherwise it's erratic.
98+
ifndef USB_MSC_NUM_ENDPOINT_PAIRS
99+
USB_MSC_NUM_ENDPOINT_PAIRS = 1
100+
endif
101+
89102
SUPERVISOR_O = $(addprefix $(BUILD)/, $(SRC_SUPERVISOR:.c=.o)) $(BUILD)/autogen_display_resources.o
90103

91104
$(BUILD)/supervisor/shared/translate.o: $(HEADER_BUILD)/qstrdefs.generated.h
@@ -103,6 +116,9 @@ autogen_usb_descriptor.intermediate: ../../tools/gen_usb_descriptor.py Makefile
103116
--vid $(USB_VID)\
104117
--pid $(USB_PID)\
105118
--serial_number_length $(USB_SERIAL_NUMBER_LENGTH)\
119+
--devices $(USB_DEVICES)\
120+
--hid_devices $(USB_HID_DEVICES)\
121+
--msc_num_endpoint_pairs $(USB_MSC_NUM_ENDPOINT_PAIRS)\
106122
--output_c_file $(BUILD)/autogen_usb_descriptor.c\
107123
--output_h_file $(BUILD)/genhdr/autogen_usb_descriptor.h
108124

tools/build_board_info.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def get_current_info():
118118
current_info[info["id"]] = info
119119
return git_info, current_info
120120

121-
def create_pr(changes, updated, git_info):
121+
def create_pr(changes, updated, git_info, user):
122122
commit_sha, original_blob_sha = git_info
123123
branch_name = "new_release_" + changes["new_release"]
124124

@@ -139,7 +139,7 @@ def create_pr(changes, updated, git_info):
139139
languages = ""
140140
if changes["new_languages"]:
141141
languages = "New languages:\n* " + "\n* ".join(changes["new_languages"])
142-
message = "Automated website update for release {} by AdaBot.\n\n{}\n\n{}\n".format(
142+
message = "Automated website update for release {} by Blinka.\n\n{}\n\n{}\n".format(
143143
changes["new_release"],
144144
boards,
145145
languages
@@ -149,7 +149,7 @@ def create_pr(changes, updated, git_info):
149149
"ref": "refs/heads/" + branch_name,
150150
"sha": commit_sha
151151
}
152-
response = github.post("/repos/adafruit-adabot/circuitpython-org/git/refs", json=create_branch)
152+
response = github.post("/repos/{}/circuitpython-org/git/refs".format(user), json=create_branch)
153153
if not response.ok and response.json()["message"] != "Reference already exists":
154154
print("unable to create branch")
155155
print(response.text)
@@ -162,14 +162,14 @@ def create_pr(changes, updated, git_info):
162162
"branch": branch_name
163163
}
164164

165-
response = github.put("/repos/adafruit-adabot/circuitpython-org/contents/_data/files.json", json=update_file)
165+
response = github.put("/repos/{}/circuitpython-org/contents/_data/files.json".format(user), json=update_file)
166166
if not response.ok:
167167
print("unable to post new file")
168168
print(response.text)
169169
return
170170
pr_info = {
171171
"title": pr_title,
172-
"head": "adafruit-adabot:" + branch_name,
172+
"head": user + ":" + branch_name,
173173
"base": "master",
174174
"body": message,
175175
"maintainer_can_modify": True
@@ -199,9 +199,12 @@ def update_downloads(boards, release):
199199
def print_active_user():
200200
response = github.get("/user")
201201
if response.ok:
202-
print("Logged in as {}".format(response.json()["login"]))
202+
user = response.json()["login"]
203+
print("Logged in as {}".format(user))
204+
return user
203205
else:
204206
print("Not logged in")
207+
return None
205208

206209
def generate_download_info():
207210
boards = {}
@@ -215,7 +218,7 @@ def generate_download_info():
215218
"new_languages": []
216219
}
217220

218-
print_active_user()
221+
user = print_active_user()
219222

220223
sha, this_version = get_version_info()
221224

@@ -272,8 +275,8 @@ def generate_download_info():
272275

273276
changes["new_languages"] = set(languages) - previous_languages
274277

275-
if changes["new_release"]:
276-
create_pr(changes, current_info, git_info)
278+
if changes["new_release"] and user:
279+
create_pr(changes, current_info, git_info, user)
277280
else:
278281
print("No new release to update")
279282

0 commit comments

Comments
 (0)