diff --git a/Controllers/HIDLampArrayController/HIDLampArrayController.cpp b/Controllers/HIDLampArrayController/HIDLampArrayController.cpp index 83ce03016..0a9127fb7 100644 --- a/Controllers/HIDLampArrayController/HIDLampArrayController.cpp +++ b/Controllers/HIDLampArrayController/HIDLampArrayController.cpp @@ -15,11 +15,10 @@ #include "HIDLampArrayController.h" #include "StringUtils.h" -HIDLampArrayController::HIDLampArrayController(hid_device *dev_handle, const char *path, std::string dev_name) +HIDLampArrayController::HIDLampArrayController(hid_device *dev_handle, const char *path) { dev = dev_handle; location = path; - name = dev_name; /*-----------------------------------------------------*\ | Parse report IDs from descriptor | @@ -128,10 +127,18 @@ std::string HIDLampArrayController::GetDeviceLocation() std::string HIDLampArrayController::GetDeviceName() { - return(name); + wchar_t name_string[128]; + int ret = hid_get_product_string(dev, name_string, 128); + + if(ret != 0) + { + return(""); + } + + return(StringUtils::wstring_to_string(name_string)); } -std::string HIDLampArrayController::GetSerialString() +std::string HIDLampArrayController::GetDeviceSerial() { wchar_t serial_string[128]; int ret = hid_get_serial_number_string(dev, serial_string, 128); @@ -144,6 +151,19 @@ std::string HIDLampArrayController::GetSerialString() return(StringUtils::wstring_to_string(serial_string)); } +std::string HIDLampArrayController::GetDeviceVendor() +{ + wchar_t vendor_string[128]; + int ret = hid_get_manufacturer_string(dev, vendor_string, 128); + + if(ret != 0) + { + return(""); + } + + return(StringUtils::wstring_to_string(vendor_string)); +} + unsigned int HIDLampArrayController::GetLampArrayKind() { return(LampArray.LampArrayKind); diff --git a/Controllers/HIDLampArrayController/HIDLampArrayController.h b/Controllers/HIDLampArrayController/HIDLampArrayController.h index a34efd4fe..edd33123d 100644 --- a/Controllers/HIDLampArrayController/HIDLampArrayController.h +++ b/Controllers/HIDLampArrayController/HIDLampArrayController.h @@ -109,12 +109,13 @@ enum class HIDLampArrayController { public: - HIDLampArrayController(hid_device *dev_handle, const char *path, std::string dev_name); + HIDLampArrayController(hid_device *dev_handle, const char *path); ~HIDLampArrayController(); std::string GetDeviceLocation(); std::string GetDeviceName(); - std::string GetSerialString(); + std::string GetDeviceSerial(); + std::string GetDeviceVendor(); unsigned int GetLampArrayKind(); unsigned int GetLampCount(); @@ -126,7 +127,6 @@ private: hid_device * dev; HIDLampArrayReportIDs ids; std::string location; - std::string name; /*-----------------------------------------------------*\ | Vector to store lamp attributes for each lamp | diff --git a/Controllers/HIDLampArrayController/HIDLampArrayControllerDetect.cpp b/Controllers/HIDLampArrayController/HIDLampArrayControllerDetect.cpp index 27901ab32..15c5d1618 100644 --- a/Controllers/HIDLampArrayController/HIDLampArrayControllerDetect.cpp +++ b/Controllers/HIDLampArrayController/HIDLampArrayControllerDetect.cpp @@ -16,7 +16,7 @@ #include #include -DetectedControllers DetectHIDLampArrayControllers(hid_device_info* info, const std::string& name) +DetectedControllers DetectHIDLampArrayControllers(hid_device_info* info, const std::string& /*name*/) { DetectedControllers detected_controllers; hid_device* dev; @@ -25,7 +25,7 @@ DetectedControllers DetectHIDLampArrayControllers(hid_device_info* info, const s if(dev) { - HIDLampArrayController* controller = new HIDLampArrayController(dev, info->path, name); + HIDLampArrayController* controller = new HIDLampArrayController(dev, info->path); RGBController_HIDLampArray* rgb_controller = new RGBController_HIDLampArray(controller); detected_controllers.push_back(rgb_controller); diff --git a/Controllers/HIDLampArrayController/RGBController_HIDLampArray.cpp b/Controllers/HIDLampArrayController/RGBController_HIDLampArray.cpp index 43bd0dbde..2597f30eb 100644 --- a/Controllers/HIDLampArrayController/RGBController_HIDLampArray.cpp +++ b/Controllers/HIDLampArrayController/RGBController_HIDLampArray.cpp @@ -25,10 +25,10 @@ RGBController_HIDLampArray::RGBController_HIDLampArray(HIDLampArrayController* c controller = controller_ptr; name = controller->GetDeviceName(); - vendor = "Generic"; description = "HID LampArray Device"; location = controller->GetDeviceLocation(); - serial = controller->GetSerialString(); + serial = controller->GetDeviceSerial(); + vendor = controller->GetDeviceVendor(); /*-----------------------------------------------------*\ | Determine device type from LampArray kind |