diff --git a/right/src/usb_commands/usb_command_get_module_property.c b/right/src/usb_commands/usb_command_get_module_property.c index b4ff9f6..7a801ca 100644 --- a/right/src/usb_commands/usb_command_get_module_property.c +++ b/right/src/usb_commands/usb_command_get_module_property.c @@ -12,10 +12,15 @@ void UsbCommand_GetModuleProperty() SetUsbTxBufferUint8(0, UsbStatusCode_GetModuleProperty_InvalidModuleSlotId); } - uint8_t moduleDriverId = SLOT_ID_TO_UHK_MODULE_DRIVER_ID(slotId); - uhk_module_state_t *moduleState = UhkModuleStates + moduleDriverId; - - GenericHidOutBuffer[1] = moduleState->moduleId; - memcpy(GenericHidOutBuffer + 2, &moduleState->moduleProtocolVersion, sizeof(version_t)); - memcpy(GenericHidOutBuffer + 2 + sizeof(version_t), &moduleState->firmwareVersion, sizeof(version_t)); + module_property_id_t modulePropertyId = GetUsbRxBufferUint8(2); + switch (modulePropertyId) { + case ModulePropertyId_VersionNumbers: { + uint8_t moduleDriverId = SLOT_ID_TO_UHK_MODULE_DRIVER_ID(slotId); + uhk_module_state_t *moduleState = UhkModuleStates + moduleDriverId; + GenericHidOutBuffer[1] = moduleState->moduleId; + memcpy(GenericHidOutBuffer + 2, &moduleState->moduleProtocolVersion, sizeof(version_t)); + memcpy(GenericHidOutBuffer + 8, &moduleState->firmwareVersion, sizeof(version_t)); + break; + } + } } diff --git a/right/src/usb_commands/usb_command_get_module_property.h b/right/src/usb_commands/usb_command_get_module_property.h index c4631e4..e886a56 100644 --- a/right/src/usb_commands/usb_command_get_module_property.h +++ b/right/src/usb_commands/usb_command_get_module_property.h @@ -7,6 +7,10 @@ // Typedefs: + typedef enum { + ModulePropertyId_VersionNumbers = 0, + } module_property_id_t; + typedef enum { UsbStatusCode_GetModuleProperty_InvalidModuleSlotId = 2, } usb_status_code_get_module_property_t;