diff --git a/CD32ControllerUSB/CD32ControllerUSB.ino b/CD32ControllerUSB/CD32ControllerUSB.ino index 4d75e33..9c54e2f 100644 --- a/CD32ControllerUSB/CD32ControllerUSB.ino +++ b/CD32ControllerUSB/CD32ControllerUSB.ino @@ -23,6 +23,10 @@ #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 = "CD32/C= to USB"; + #define BUTTON_READ_DELAY 100 // Button read delay in µs // Controller DB9 pins (looking face-on to the end of the plug): diff --git a/CD32ControllerUSB/Gamepad.cpp b/CD32ControllerUSB/Gamepad.cpp index eddab2b..879fe2f 100644 --- a/CD32ControllerUSB/Gamepad.cpp +++ b/CD32ControllerUSB/Gamepad.cpp @@ -24,8 +24,6 @@ * */ -#pragma once - #include "Gamepad.h" static const uint8_t _hidReportDescriptor[] PROGMEM = { @@ -146,5 +144,10 @@ void Gamepad_::send() uint8_t Gamepad_::getShortName(char *name) { + if(!next) + { + strcpy(name, gp_serial); + return strlen(name); + } return 0; } diff --git a/CD32ControllerUSB/Gamepad.h b/CD32ControllerUSB/Gamepad.h index 3468a9a..d2bd4c0 100644 --- a/CD32ControllerUSB/Gamepad.h +++ b/CD32ControllerUSB/Gamepad.h @@ -29,11 +29,7 @@ #include #include "HID.h" -// NOTE: To make this work on the MiSTer (or possibly other Linux distros), -// you need to edit USBDesc.h like follows. Change: -// #define ISERIAL 3 -// to -// #define ISERIAL 0 +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