diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e8859ec33eb8c..da952a9e04996 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -482,7 +482,7 @@ jobs: id: idf-cache with: path: ${{ github.workspace }}/.idf_tools - key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20210304 + key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20210422 - name: Clone IDF submodules run: | (cd $IDF_PATH && git submodule update --init) diff --git a/.github/workflows/create_website_pr.yml b/.github/workflows/create_website_pr.yml index a66bb161c4bbc..97c543da0d747 100644 --- a/.github/workflows/create_website_pr.yml +++ b/.github/workflows/create_website_pr.yml @@ -16,6 +16,10 @@ jobs: env: GITHUB_CONTEXT: ${{ toJson(github) }} run: echo "$GITHUB_CONTEXT" + - uses: actions/checkout@v2.2.0 + with: + submodules: true + fetch-depth: 0 - name: Set up Python 3.8 uses: actions/setup-python@v1 with: @@ -27,10 +31,6 @@ jobs: run: | gcc --version python3 --version - - uses: actions/checkout@v2.2.0 - with: - submodules: true - fetch-depth: 0 - run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/* - name: CircuitPython version run: git describe --dirty --tags diff --git a/ports/esp32s2/common-hal/busio/UART.c b/ports/esp32s2/common-hal/busio/UART.c index 7da5c0f944085..7af43a476de20 100644 --- a/ports/esp32s2/common-hal/busio/UART.c +++ b/ports/esp32s2/common-hal/busio/UART.c @@ -291,13 +291,14 @@ size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data, mp_raise_ValueError(translate("No TX pin")); } - while (len > 0) { - int count = uart_tx_chars(self->uart_num, (const char *)data, len); + size_t left_to_write = len; + while (left_to_write > 0) { + int count = uart_tx_chars(self->uart_num, (const char *)data, left_to_write); if (count < 0) { *errcode = MP_EAGAIN; return MP_STREAM_ERROR; } - len -= count; + left_to_write -= count; data += count; RUN_BACKGROUND_TASKS; } diff --git a/ports/raspberrypi/common-hal/busio/UART.c b/ports/raspberrypi/common-hal/busio/UART.c index 2d8ff099eb11c..e7ba64b098015 100644 --- a/ports/raspberrypi/common-hal/busio/UART.c +++ b/ports/raspberrypi/common-hal/busio/UART.c @@ -191,12 +191,13 @@ size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data, mp_raise_ValueError(translate("No TX pin")); } - while (len > 0) { - while (uart_is_writable(self->uart) && len > 0) { + size_t left_to_write = len; + while (left_to_write > 0) { + while (uart_is_writable(self->uart) && left_to_write > 0) { // Write and advance. uart_get_hw(self->uart)->dr = *data++; // Decrease how many chars left to write. - len--; + left_to_write--; } RUN_BACKGROUND_TASKS; } diff --git a/tools/gen_usb_descriptor.py b/tools/gen_usb_descriptor.py index 9c4efaca3d28e..1fad2fbeb32fe 100644 --- a/tools/gen_usb_descriptor.py +++ b/tools/gen_usb_descriptor.py @@ -17,9 +17,11 @@ ALL_DEVICES_SET = frozenset(ALL_DEVICES.split()) DEFAULT_DEVICES = "CDC MSC AUDIO HID" +# This list is in preferred order. MacOS does not like GAMEPAD coming before MOUSE. ALL_HID_DEVICES = ( "KEYBOARD MOUSE CONSUMER SYS_CONTROL GAMEPAD DIGITIZER XAC_COMPATIBLE_GAMEPAD RAW" ) +ALL_HID_DEVICES_ORDER = dict((name, idx) for (idx, name) in enumerate(ALL_HID_DEVICES.split())) ALL_HID_DEVICES_SET = frozenset(ALL_HID_DEVICES.split()) # Digitizer works on Linux but conflicts with mouse, so omit it. DEFAULT_HID_DEVICES = "KEYBOARD MOUSE CONSUMER GAMEPAD" @@ -352,7 +354,8 @@ def make_cdc_data_interface(name, cdc_ep_num_data_in, cdc_ep_num_data_out): else: report_id = 1 concatenated_descriptors = bytearray() - for name in args.hid_devices: + # Sort HID devices by preferred order. + for name in sorted(args.hid_devices, key=ALL_HID_DEVICES_ORDER.get): concatenated_descriptors.extend( bytes(hid_report_descriptors.REPORT_DESCRIPTOR_FUNCTIONS[name](report_id)) )