diff --git a/SegaControllerUSB/Gamepad.cpp b/SegaControllerUSB/Gamepad.cpp index eddab2b..8eef31d 100644 --- a/SegaControllerUSB/Gamepad.cpp +++ b/SegaControllerUSB/Gamepad.cpp @@ -146,5 +146,10 @@ void Gamepad_::send() uint8_t Gamepad_::getShortName(char *name) { + if(!next) + { + strcpy(name, gp_serial); + return strlen(name); + } return 0; } diff --git a/SegaControllerUSB/Gamepad.h b/SegaControllerUSB/Gamepad.h index a39ebdc..d2bd4c0 100644 --- a/SegaControllerUSB/Gamepad.h +++ b/SegaControllerUSB/Gamepad.h @@ -29,6 +29,8 @@ #include #include "HID.h" +extern const char* gp_serial; + // The numbers after colon are bit fields, meaning how many bits the field uses. // Remove those if there are problems typedef struct { diff --git a/SegaControllerUSB/SegaControllerUSB.ino b/SegaControllerUSB/SegaControllerUSB.ino index d318d5e..7a4feb9 100644 --- a/SegaControllerUSB/SegaControllerUSB.ino +++ b/SegaControllerUSB/SegaControllerUSB.ino @@ -24,6 +24,10 @@ #include "SegaController32U4.h" #include "Gamepad.h" +// ATT: 20 chars max (including NULL at the end) according to Arduino source code. +// Additionally serial number is used to differentiate arduino projects to have different button maps! +const char *gp_serial = "Sega/C= to USB"; + // Controller DB9 pins (looking face-on to the end of the plug): // // 5 4 3 2 1 diff --git a/SegaTwoControllersUSB/Gamepad.cpp b/SegaTwoControllersUSB/Gamepad.cpp index eddab2b..8eef31d 100644 --- a/SegaTwoControllersUSB/Gamepad.cpp +++ b/SegaTwoControllersUSB/Gamepad.cpp @@ -146,5 +146,10 @@ void Gamepad_::send() uint8_t Gamepad_::getShortName(char *name) { + if(!next) + { + strcpy(name, gp_serial); + return strlen(name); + } return 0; } diff --git a/SegaTwoControllersUSB/Gamepad.h b/SegaTwoControllersUSB/Gamepad.h index a39ebdc..d2bd4c0 100644 --- a/SegaTwoControllersUSB/Gamepad.h +++ b/SegaTwoControllersUSB/Gamepad.h @@ -29,6 +29,8 @@ #include #include "HID.h" +extern const char* gp_serial; + // The numbers after colon are bit fields, meaning how many bits the field uses. // Remove those if there are problems typedef struct { diff --git a/SegaTwoControllersUSB/SegaTwoControllersUSB.ino b/SegaTwoControllersUSB/SegaTwoControllersUSB.ino index d1e7775..a512640 100644 --- a/SegaTwoControllersUSB/SegaTwoControllersUSB.ino +++ b/SegaTwoControllersUSB/SegaTwoControllersUSB.ino @@ -24,6 +24,10 @@ #include "SegaControllers32U4.h" #include "Gamepad.h" +// ATT: 20 chars max (including NULL at the end) according to Arduino source code. +// Additionally serial number is used to differentiate arduino projects to have different button maps! +const char *gp_serial = "Sega/C= to USB"; + // Controller DB9 pins (looking face-on to the end of the plug): // // 5 4 3 2 1