Changing Wooting KB detection to PU

* Simplified detection
* Adding more useful data to `info page`
* Adding DEBUG logging
This commit is contained in:
Chris 2021-06-27 16:35:25 +10:00 committed by Adam Honse
parent 62906e7f10
commit ad6d605c88
4 changed files with 74 additions and 89 deletions

View file

@ -58,9 +58,25 @@ static uint16_t getCrc16ccitt(const uint8_t* buffer, uint16_t size)
return crc;
}
WootingKeyboardController::WootingKeyboardController(hid_device* dev_handle)
WootingKeyboardController::WootingKeyboardController(hid_device* dev_handle, const char *path)
{
const int szTemp = 256;
wchar_t tmpName[szTemp];
dev = dev_handle;
location = path;
hid_get_manufacturer_string(dev, tmpName, szTemp);
std::wstring wName = std::wstring(tmpName);
vendor = std::string(wName.begin(), wName.end());
hid_get_product_string(dev, tmpName, szTemp);
wName = std::wstring(tmpName);
description = std::string(wName.begin(), wName.end());
hid_get_serial_number_string(dev, tmpName, szTemp);
wName = std::wstring(tmpName);
serial = std::string(wName.begin(), wName.end());
SendInitialize();
}
@ -70,6 +86,31 @@ WootingKeyboardController::~WootingKeyboardController()
}
std::string WootingKeyboardController::GetName()
{
return name;
}
std::string WootingKeyboardController::GetVendor()
{
return vendor;
}
std::string WootingKeyboardController::GetLocation()
{
return("HID: " + location);
}
std::string WootingKeyboardController::GetDescription()
{
return description;
}
std::string WootingKeyboardController::GetSerial()
{
return serial;
}
void WootingKeyboardController::SendDirect(RGBColor* colors, unsigned int num_colors)
{
const uint8_t pwm_mem_map[48] =