diff options
Diffstat (limited to 'libusb')
-rw-r--r-- | libusb/CMakeLists.txt | 4 | ||||
-rw-r--r-- | libusb/include/libusb/tusb_helpers.h | 2 | ||||
-rwxr-xr-x | libusb/include/libusb/tusb_helpers.h.gen | 21 | ||||
-rw-r--r-- | libusb/usb_common.c | 23 |
4 files changed, 28 insertions, 22 deletions
diff --git a/libusb/CMakeLists.txt b/libusb/CMakeLists.txt index 012ab71..b11e798 100644 --- a/libusb/CMakeLists.txt +++ b/libusb/CMakeLists.txt @@ -1,10 +1,10 @@ # libusb/CMakeLists.txt - Build script for libusb support library # -# Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com> +# Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> # SPDX-License-Identifier: AGPL-3.0-or-later add_library(libusb INTERFACE) -target_include_directories(libusb SYSTEM INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include) +target_include_directories(libusb PUBLIC INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include) target_sources(libusb INTERFACE usb_common.c ) diff --git a/libusb/include/libusb/tusb_helpers.h b/libusb/include/libusb/tusb_helpers.h index 1b4e48e..0c35f62 100644 --- a/libusb/include/libusb/tusb_helpers.h +++ b/libusb/include/libusb/tusb_helpers.h @@ -1,7 +1,7 @@ /* Generated by `libusb/include/libusb/tusb_helpers.h.gen `. DO NOT EDIT! */ /* libusb/tusb_helpers.h - Preprocessor macros that I think should be included in TinyUSB * - * Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com> + * Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> * * SPDX-License-Identifier: MIT * diff --git a/libusb/include/libusb/tusb_helpers.h.gen b/libusb/include/libusb/tusb_helpers.h.gen index 5a5d1ac..1de1d09 100755 --- a/libusb/include/libusb/tusb_helpers.h.gen +++ b/libusb/include/libusb/tusb_helpers.h.gen @@ -7,7 +7,7 @@ echo "/* Generated by \`$0 $*\`. DO NOT EDIT! */" cat <<'EOT' /* libusb/tusb_helpers.h - Preprocessor macros that I think should be included in TinyUSB * - * Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com> + * Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> * * SPDX-License-Identifier: MIT * @@ -70,12 +70,19 @@ fi if [[ ! -f 3rd-party/MS-LCID.txt || 3rd-party/MS-LCID.txt -ot 3rd-party/MS-LCID.pdf ]]; then pdftotext -layout 3rd-party/MS-LCID.pdf fi -<3rd-party/MS-LCID.txt \ - grep -E '^\s*0x[0-9A-F]{4}\s+[a-z]' | sed 's/,.*//' | grep -v reserved | # find the lines we're interested in - sed -E 's/^\s*0x(..)(..)\s+(\S.*)/\2 \1 \3/p' | tr '[:lower:]-' '[:upper:]_' | # format them as 'PRIhex SUBhex UPPER_STR' - sort | - sed -E 's/(..) (..) (.*)/#define LANGID_\3 0x\2\1/' | # format them as '#define LANGID_UPPER_STR 0xSUBPRI' - column --table --output-separator=' ' +{ + { + # find the lines we're interested in + grep -E '^\s*0x[0-9A-F]{4}\s+[a-z]' | sed 's/,.*//' | grep -v reserved + } | { + # format them as 'PRIhex SUBhex UPPER_STR' + sed -E 's/^\s*0x(..)(..)\s+(\S.*)/\2 \1 \3/p' | tr '[:lower:]-' '[:upper:]_' + } | sort | { + # format them as '#define LANGID_UPPER_STR 0xSUBPRI' + sed -E 's/(..) (..) (.*)/#define LANGID_\3 0x\2\1/' | + column --table --output-separator=' ' + } +} <3rd-party/MS-LCID.txt cat <<'EOT' /** USB 2.0 ยง9.6.6 "Endpoint", field bEndpointAddress, bit 7 */ diff --git a/libusb/usb_common.c b/libusb/usb_common.c index 29dec42..4fe7dd4 100644 --- a/libusb/usb_common.c +++ b/libusb/usb_common.c @@ -1,15 +1,15 @@ /* libusb/usb_common.c - Common framework for implementing multiple USB devices at once * - * Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com> + * Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> * SPDX-License-Identifier: AGPL-3.0-or-later */ -#include <stdint.h> /* for uint{n}_t types */ -#include <stddef.h> /* for size_t */ -#include <string.h> /* memcpy() */ -#include <stdlib.h> /* for malloc(), realloc(), reallocarray() */ +#include <stddef.h> /* for size_t */ +#include <stdint.h> /* for uint{n}_t types */ +#include <stdlib.h> /* for malloc(), realloc(), reallocarray() */ +#include <string.h> /* memcpy() */ -#include <tusb.h> /* for various tusb_*_t types */ +#include <tusb.h> /* for various tusb_*_t types */ #include <libmisc/assert.h> @@ -30,7 +30,7 @@ static struct { uint8_t **configv; uint16_t *serial; uint8_t serial_bytelen; -} globals = {0}; +} globals = {}; /* Strings ********************************************************************/ @@ -68,12 +68,12 @@ uint16_t const *tud_descriptor_string_cb(uint8_t strid, uint16_t langid) { memcpy(desc.bString, globals.serial, bytelen); break; default: - debugf("GET STRING: unknown string id=%"PRIu8, strid); + log_debugln("GET STRING: unknown string id=", strid); return NULL; } break; default: - debugf("GET STRING: unknown LANGID=%"PRIx16, langid); + log_debugln("GET STRING: unknown LANGID=", (base16_u16_, langid)); return NULL; } } @@ -100,8 +100,7 @@ void usb_common_lateinit(void) { tud_init(CONFIG_USB_COMMON_RHPORT); } -COROUTINE usb_common_cr(void *_arg) { - (void) _arg; +COROUTINE usb_common_cr(void *LM_UNUSED(_arg)) { cr_begin(); for (;;) { @@ -185,7 +184,7 @@ uint8_t const *tud_descriptor_device_cb(void) { .bNumConfigurations = 0, /* Number of possible configurations */ }; desc.bNumConfigurations = globals.configc; - return (uint8_t const *) &desc; + return (uint8_t const *)&desc; } /** |