Skip to content

Commit

Permalink
Merge pull request #332 from adafruit/correct-pid-qtpys3-n4r2
Browse files Browse the repository at this point in the history
correct usb pid for qt s3 n4r2
  • Loading branch information
hathach authored Jun 30, 2023
2 parents 40a850f + 9a39527 commit 7ddfe22
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions ports/espressif/boards/adafruit_qtpy_esp32s3_n4r2/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@
//--------------------------------------------------------------------+

#define USB_VID 0x239A
#define USB_PID 0x0119 // TODO may need update
#define USB_PID 0x0143

#define USB_MANUFACTURER "Adafruit"
#define USB_PRODUCT "QT Py ESP32-S3"
#define USB_PRODUCT "QT Py ESP32-S3 (4M Flash, 2M PSRAM)"

#define UF2_PRODUCT_NAME USB_MANUFACTURER " " USB_PRODUCT
#define UF2_BOARD_ID "ESP32S3-QTPy-N4R2-A"
Expand Down
11 changes: 6 additions & 5 deletions src/usb_descriptors.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ char const* string_desc_arr [] =
"HF2 WebUSB"
};

static uint16_t _desc_str[32+1];
static uint16_t _desc_str[48+1];

// Invoked when received GET STRING DESCRIPTOR request
// Application return pointer to descriptor, whose contents must exist long enough for transfer to complete
Expand Down Expand Up @@ -215,14 +215,15 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
// Convert ASCII string into UTF-16
if ( !(index < sizeof(string_desc_arr)/sizeof(string_desc_arr[0])) ) return NULL;

uint16_t const max_count = (sizeof(_desc_str)/sizeof(_desc_str[0])) - 1;

const char* str = string_desc_arr[index];
chr_count = strlen(str);

// Cap at max char
chr_count = strlen(str);
if ( chr_count > 31 ) chr_count = 31;
if ( chr_count > max_count ) chr_count = max_count;

for(uint8_t i=0; i<chr_count; i++)
{
for(uint8_t i=0; i<chr_count; i++) {
_desc_str[1+i] = str[i];
}
}
Expand Down

0 comments on commit 7ddfe22

Please sign in to comment.