Skip to content

Commit 455a1f9

Browse files
Chr1sNoCalcProgrammer1
authored andcommitted
Adjust Windows Logitech Lightspeed detection to resolve #2621
+ Changing to IPU detector to ensure 1 hit (per device) + Bundling all usages on Interface 2
1 parent f874522 commit 455a1f9

1 file changed

Lines changed: 20 additions & 23 deletions

File tree

Controllers/LogitechController/LogitechControllerDetect.cpp

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -766,33 +766,30 @@ usages BundleLogitechUsages(hid_device_info* info)
766766
| Grab all usages that you can open. For normal Logitech FAP |
767767
| devices this will be usage 1, 2 and 4 |
768768
\*-----------------------------------------------------------------*/
769+
usages temp_usages;
769770

770-
usages temp_usages;
771-
uint16_t current_pid = info->product_id;
772-
hid_device_info* temp_info = info;
773-
774-
/*-----------------------------------------------------------------*\
775-
| To avoid duplicate entries per device only look from usage 1 |
776-
\*-----------------------------------------------------------------*/
777-
if(temp_info->usage == 1)
771+
hid_device_info* temp_info = hid_enumerate(info->vendor_id, info->product_id);
772+
while(temp_info)
778773
{
779-
while(temp_info)
774+
/*-----------------------------------------------------------------*\
775+
| Only bundle the device that triggered this callback |
776+
\*-----------------------------------------------------------------*/
777+
if(temp_info->interface_number == 2)
780778
{
781-
/*-----------------------------------------------------------------*\
782-
| Only bundle the device that triggered this callback |
783-
\*-----------------------------------------------------------------*/
784-
if(temp_info->product_id == current_pid)
785-
{
786-
hid_device* dev = hid_open_path(temp_info->path);
779+
LOG_DEBUG("Attempting to open dev path: %s", info->path);
780+
hid_device* dev = hid_open_path(temp_info->path);
787781

788-
if(dev)
789-
{
790-
LOG_DEBUG("Adding Usage %i for device @ path %s", temp_info->usage, temp_info->path);
791-
temp_usages.emplace((uint8_t)temp_info->usage, dev);
792-
}
782+
if(dev)
783+
{
784+
LOG_DEBUG("Success! Adding Usage %i for device @ path %s", temp_info->usage, temp_info->path);
785+
temp_usages.emplace((uint8_t)temp_info->usage, dev);
786+
}
787+
else
788+
{
789+
LOG_INFO("FAILED! Can not add Usage %i for device @ path %s", temp_info->usage, temp_info->path);
793790
}
794-
temp_info = temp_info->next;
795791
}
792+
temp_info = temp_info->next;
796793
}
797794

798795
return temp_usages;
@@ -833,8 +830,8 @@ void DetectLogitechLightspeedReceiver(hid_device_info* info, const std::string&
833830
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
834831
| Lightspeed Receivers (Windows Wireless) |
835832
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
836-
REGISTER_HID_DETECTOR_IP("Logitech Lightspeed Receiver", DetectLogitechLightspeedReceiver, LOGITECH_VID, LOGITECH_G_LIGHTSPEED_RECEIVER_PID, 2, 0xFF00);
837-
REGISTER_HID_DETECTOR_IP("Logitech G Powerplay Mousepad", DetectLogitechLightspeedReceiver, LOGITECH_VID, LOGITECH_G_LIGHTSPEED_POWERPLAY_PID, 2, 0xFF00);
833+
REGISTER_HID_DETECTOR_IPU("Logitech Lightspeed Receiver", DetectLogitechLightspeedReceiver, LOGITECH_VID, LOGITECH_G_LIGHTSPEED_RECEIVER_PID, 2, 0xFF00, 1);
834+
REGISTER_HID_DETECTOR_IPU("Logitech G Powerplay Mousepad", DetectLogitechLightspeedReceiver, LOGITECH_VID, LOGITECH_G_LIGHTSPEED_POWERPLAY_PID, 2, 0xFF00, 1);
838835

839836
#endif
840837

0 commit comments

Comments
 (0)