Store name in DasKeyboardController to avoid setting it in detector

This commit is contained in:
Adam Honse 2025-08-06 17:13:55 -05:00
parent e6190ec275
commit 718962c188
4 changed files with 41 additions and 80 deletions

View file

@ -15,10 +15,11 @@
using namespace std::chrono_literals;
DasKeyboardController::DasKeyboardController(hid_device *dev_handle, const char *path)
DasKeyboardController::DasKeyboardController(hid_device *dev_handle, const char *path, std::string dev_name)
{
dev = dev_handle;
location = path;
name = dev_name;
version = "";
useTraditionalSendData = false;
@ -30,11 +31,36 @@ DasKeyboardController::~DasKeyboardController()
hid_close(dev);
}
std::string DasKeyboardController::GetDeviceLocation()
std::string DasKeyboardController::GetLayoutString()
{
/*-----------------------------------------------------------*\
| Experimental for now; should be '16 or 63' for US and '28' |
| for EU layout |
\*-----------------------------------------------------------*/
if(version.length() < 17)
{
return("NONE");
}
std::string layout_id = version.substr(3, 2);
if(layout_id == "16" || layout_id == "63")
{
return("US");
}
return("EU");
}
std::string DasKeyboardController::GetLocationString()
{
return("HID: " + location);
}
std::string DasKeyboardController::GetNameString()
{
return(name);
}
std::string DasKeyboardController::GetSerialString()
{
wchar_t serial_string[128];
@ -64,26 +90,6 @@ std::string DasKeyboardController::GetVersionString()
return(fw_version);
}
std::string DasKeyboardController::GetLayoutString()
{
/*-----------------------------------------------------------*\
| Experimental for now; should be '16 or 63' for US and '28' |
| for EU layout |
\*-----------------------------------------------------------*/
if(version.length() < 17)
{
return("NONE");
}
std::string layout_id = version.substr(3, 2);
if(layout_id == "16" || layout_id == "63")
{
return("US");
}
return("EU");
}
void DasKeyboardController::SendColors(unsigned char key_id, unsigned char mode,
unsigned char red, unsigned char green, unsigned char blue)
{