diff --git a/src/servers/input/AddOnManager.cpp b/src/servers/input/AddOnManager.cpp index 6a8b39c68d..c9b0afbbbf 100644 --- a/src/servers/input/AddOnManager.cpp +++ b/src/servers/input/AddOnManager.cpp @@ -678,13 +678,14 @@ AddOnManager::HandleFindDevices(BMessage* message, BMessage* reply) CALLED(); const char *name = NULL; input_device_type type; - if (message->FindString("device", &name) != B_OK - || gInputServer->GetDeviceInfo(name, &type) != B_OK) - return B_NAME_NOT_FOUND; - - reply->AddString("device", name); - reply->AddInt32("type", type); - + if (message->FindString("device", &name) == B_OK) { + if (gInputServer->GetDeviceInfo(name, &type) != B_OK) + return B_NAME_NOT_FOUND; + reply->AddString("device", name); + reply->AddInt32("type", type); + } else { + gInputServer->GetDeviceInfos(reply); + } return B_OK; } diff --git a/src/servers/input/InputServer.cpp b/src/servers/input/InputServer.cpp index 1b7f3aa9fe..7cc814b7e0 100644 --- a/src/servers/input/InputServer.cpp +++ b/src/servers/input/InputServer.cpp @@ -1054,6 +1054,21 @@ InputServer::GetDeviceInfo(const char* name, input_device_type *_type, } +status_t +InputServer::GetDeviceInfos(BMessage *msg) +{ + CALLED(); + BAutolock lock(fInputDeviceListLocker); + + for (int32 i = fInputDeviceList.CountItems() - 1; i >= 0; i--) { + InputDeviceListItem* item = (InputDeviceListItem*)fInputDeviceList.ItemAt(i); + msg->AddString("device", item->Name()); + msg->AddInt32("type", item->Type()); + } + return B_OK; +} + + status_t InputServer::UnregisterDevices(BInputServerDevice& serverDevice, input_device_ref **devices) diff --git a/src/servers/input/InputServer.h b/src/servers/input/InputServer.h index d4d69ae9f1..4cc9e9827d 100644 --- a/src/servers/input/InputServer.h +++ b/src/servers/input/InputServer.h @@ -135,6 +135,7 @@ class InputServer : public BApplication { status_t GetDeviceInfo(const char* name, input_device_type *_type, bool *_isRunning = NULL); + status_t GetDeviceInfos(BMessage *msg); status_t UnregisterDevices(BInputServerDevice& serverDevice, input_device_ref** devices = NULL); status_t RegisterDevices(BInputServerDevice& serverDevice,