aboutsummaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
authorMartino Facchin <m.facchin@arduino.cc>2015-10-13 15:13:31 +0200
committerMartino Facchin <m.facchin@arduino.cc>2015-10-21 15:23:56 +0200
commitced062988bf0df175e54b77b658132685100b350 (patch)
tree5c95d5a374af46ed508e9b05870e6a658f38c3f4 /libraries
parentf42b26c257859f1b76094972727c4ebc2b412a62 (diff)
[USB] use plugged modules name to create iSerial field
Diffstat (limited to 'libraries')
-rw-r--r--libraries/HID/HID.cpp10
-rw-r--r--libraries/HID/HID.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/libraries/HID/HID.cpp b/libraries/HID/HID.cpp
index 411529e..1a432ff 100644
--- a/libraries/HID/HID.cpp
+++ b/libraries/HID/HID.cpp
@@ -57,6 +57,16 @@ int HID_::getDescriptor(USBSetup& setup)
return total;
}
+uint8_t HID_::getShortName(char *name)
+{
+ name[0] = 'H';
+ name[1] = 'I';
+ name[2] = 'D';
+ name[3] = 'A' + (descriptorSize & 0x0F);
+ name[4] = 'A' + ((descriptorSize >> 4) & 0x0F);
+ return 5;
+}
+
void HID_::AppendDescriptor(HIDSubDescriptor *node)
{
if (!rootNode) {
diff --git a/libraries/HID/HID.h b/libraries/HID/HID.h
index ba08da7..b6638c8 100644
--- a/libraries/HID/HID.h
+++ b/libraries/HID/HID.h
@@ -96,6 +96,7 @@ protected:
int getInterface(uint8_t* interfaceCount);
int getDescriptor(USBSetup& setup);
bool setup(USBSetup& setup);
+ uint8_t getShortName(char* name);
private:
uint8_t epType[1];