diff --git a/Firmware/PocketVoltex/Config.c b/Firmware/PocketVoltex/Config.c index 482f62e..a0fd12b 100644 --- a/Firmware/PocketVoltex/Config.c +++ b/Firmware/PocketVoltex/Config.c @@ -4,8 +4,6 @@ #include "Config.h" #include "Macro.h" -#define MAGIC_NUMBER 42 - uint8_t firstRun EEMEM; // init to 255 sdvx_config_t eeConfig EEMEM; @@ -49,10 +47,10 @@ static const PROGMEM sdvx_config_t defaults = { }; void InitConfig(void) { - if (eeprom_read_byte(&firstRun) != MAGIC_NUMBER) { // store defaults + if (eeprom_read_byte(&firstRun) != CONFIG_VERSION) { // store defaults memcpy_P(&sdvxConfig, &defaults, sizeof(sdvx_config_t)); eeprom_update_block(&sdvxConfig, &eeConfig, sizeof(sdvx_config_t)); - eeprom_update_byte(&firstRun, MAGIC_NUMBER); // defaults set + eeprom_update_byte(&firstRun, CONFIG_VERSION); // defaults set } eeprom_read_block(&sdvxConfig, &eeConfig, sizeof(sdvx_config_t)); } diff --git a/Firmware/PocketVoltex/Config.h b/Firmware/PocketVoltex/Config.h index 16fd2e8..0bafbfd 100644 --- a/Firmware/PocketVoltex/Config.h +++ b/Firmware/PocketVoltex/Config.h @@ -12,7 +12,9 @@ #define JOYSTICK_PPR (24 * 4) #define MAGIC_RESET_NUMBER 42 // divide by 10 for actual version -#define FIRMWARE_VERSION 11 +#define FIRMWARE_VERSION 12 +// increment whenever config structure has breaking changes +#define CONFIG_VERSION 1 // not configurable since they're all the same switches #define SWITCH_DEBOUNCE 30 diff --git a/Firmware/PocketVoltex/Descriptors.c b/Firmware/PocketVoltex/Descriptors.c index 067a30f..c777dd7 100644 --- a/Firmware/PocketVoltex/Descriptors.c +++ b/Firmware/PocketVoltex/Descriptors.c @@ -146,7 +146,26 @@ const uint8_t PROGMEM MS_OS_Descriptor[] = MS_OS_FUNCTION_SUBSET_HEADER ( INTERFACE_ID_Config, // Interface ID - MS_OS_COMPAT_ID_WINUSB + MS_OS_COMPAT_ID_WINUSB, + + + /* I'm not entirely convinced this is actually required, + but USB on Windows is finnicky at best, and apparently + this is a good idea for composite devices. It's a mystery. */ + 0x84, 0x00, //wLength: + MS_OS_20_FEATURE_REG_PROPERTY, 0x00, // wDescriptorType: MS_OS_20_FEATURE_REG_PROPERTY: 0x04 (Table 9) + 0x07, 0x00, //wPropertyDataType: REG_MULTI_SZ (Table 15) + 0x2a, 0x00, //wPropertyNameLength: + //bPropertyName: "DeviceInterfaceGUID" + 'D', 0x00, 'e', 0x00, 'v', 0x00, 'i', 0x00, 'c', 0x00, 'e', 0x00, 'I', 0x00, 'n', 0x00, 't', 0x00, 'e', 0x00, + 'r', 0x00, 'f', 0x00, 'a', 0x00, 'c', 0x00, 'e', 0x00, 'G', 0x00, 'U', 0x00, 'I', 0x00, 'D', 0x00, 's', 0x00, + 0x00, 0x00, + 0x50, 0x00, // wPropertyDataLength + //bPropertyData: "{975F44D9-0D08-43FD-8B3E-127CA8AFEF9D}". + '{', 0x00, '9', 0x00, '7', 0x00, '5', 0x00, 'F', 0x00, '4', 0x00, '4', 0x00, 'D', 0x00, '9', 0x00, '-', 0x00, + '0', 0x00, 'D', 0x00, '0', 0x00, '8', 0x00, '-', 0x00, '4', 0x00, '3', 0x00, 'F', 0x00, 'D', 0x00, '-', 0x00, + '8', 0x00, 'B', 0x00, '3', 0x00, 'E', 0x00, '-', 0x00, '1', 0x00, '2', 0x00, '7', 0x00, 'C', 0x00, 'A', 0x00, + '8', 0x00, 'A', 0x00, 'F', 0x00, 'E', 0x00, 'F', 0x00, '9', 0x00, 'D', 0x00, '}', 0x00, 0x00, 0x00, 0x00, 0x00 ) ) )