diff options
author | Vegard Storheil Eriksen <zyp@jvnv.net> | 2014-02-27 23:20:52 +0100 |
---|---|---|
committer | Vegard Storheil Eriksen <zyp@jvnv.net> | 2014-02-27 23:22:03 +0100 |
commit | e28cc949460b4940fb31f33cbbfd030ffe96de4f (patch) | |
tree | 58f314f5ac86b72b719826a7381625fa2c1bf600 /main.cpp | |
parent | 88e93d1d8a56112818e7360888aa9a2e3af52883 (diff) |
Implemented configurable label.
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
@@ -449,7 +449,8 @@ class USB_strings : public USB_class_driver { // Get string descriptor. if(bmRequestType == 0x80 && bRequest == 0x06 && (wValue & 0xff00) == 0x0300) { const void* desc = nullptr; - uint16_t buf[9]; + uint16_t buf[64] = {0x300}; + uint32_t i = 1; switch(wValue & 0xff) { case 0: @@ -461,7 +462,24 @@ class USB_strings : public USB_class_driver { break; case 2: - desc = u"\u030carcin"; + for(const char* p = "arcin"; *p; p++) { + buf[i++] = *p; + } + + if(config.label[0]) { + buf[i++] = ' '; + buf[i++] = '('; + + for(uint8_t* p = config.label; *p; p++) { + buf[i++] = *p; + } + + buf[i++] = ')'; + } + + buf[0] |= i * 2; + + desc = buf; break; case 3: |