diff options
| author | Dan Halbert <halbert@halwitz.org> | 2019-07-31 00:30:24 -0400 |
|---|---|---|
| committer | Dan Halbert <halbert@halwitz.org> | 2019-07-31 00:30:24 -0400 |
| commit | 91d791afd091ba38bb61689e88a7fc03b9679e00 (patch) | |
| tree | 5b6a29ed76964894432a011a202203425b0afe4e /supervisor | |
| parent | 83129b8c63e58596add0d111360701aab51ce62b (diff) | |
cleanup adapter.address; add uniquish suffix to BLE device name
Diffstat (limited to 'supervisor')
| -rw-r--r-- | supervisor/shared/usb/usb.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/supervisor/shared/usb/usb.c b/supervisor/shared/usb/usb.c index 0678a3a3f..c1d70c5b0 100644 --- a/supervisor/shared/usb/usb.c +++ b/supervisor/shared/usb/usb.c @@ -25,6 +25,7 @@ */ #include "tick.h" +#include "py/objstr.h" #include "shared-bindings/microcontroller/Processor.h" #include "shared-module/usb_midi/__init__.h" #include "supervisor/port.h" @@ -43,13 +44,11 @@ void load_serial_number(void) { uint8_t raw_id[COMMON_HAL_MCU_PROCESSOR_UID_LENGTH]; common_hal_mcu_processor_get_uid(raw_id); - static const char nibble_to_hex[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - 'A', 'B', 'C', 'D', 'E', 'F'}; for (int i = 0; i < COMMON_HAL_MCU_PROCESSOR_UID_LENGTH; i++) { for (int j = 0; j < 2; j++) { uint8_t nibble = (raw_id[i] >> (j * 4)) & 0xf; // Strings are UTF-16-LE encoded. - usb_serial_number[1 + i * 2 + j] = nibble_to_hex[nibble]; + usb_serial_number[1 + i * 2 + j] = nibble_to_hex_upper[nibble]; } } } |
