diff --git a/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp b/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp index 3d2d7962ce..3f6ee5cfc8 100644 --- a/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp +++ b/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp @@ -785,15 +785,22 @@ KeyboardInputDevice::GetShortName(const char *longName) CALLED(); BString string(longName); BString name; - + int32 slash = string.FindLast("/"); string.CopyInto(name, slash + 1, string.Length() - slash); int32 index = atoi(name.String()) + 1; - + int32 previousSlash = string.FindLast("/", slash); - string.CopyInto(name, previousSlash + 1, slash - previousSlash - 1); + string.CopyInto(name, previousSlash + 1, slash - previousSlash - 1); + + // some special handling so that we get "USB" and "AT" instead of "usb"/"at" + if (name.Length() < 4) + name.ToUpper(); + else + name.Capitalize(); + name << " Keyboard " << index; - + return strdup(name.String()); } diff --git a/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp b/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp index eb6af19cae..6ce186d7a6 100644 --- a/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp +++ b/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp @@ -404,7 +404,8 @@ mouse_device::~mouse_device() void MouseInputDevice::RecursiveScan(const char *directory) { - CALLED(); + CALLED(); + bool found_ps2 = false; BEntry entry; BDirectory dir(directory); @@ -414,9 +415,9 @@ MouseInputDevice::RecursiveScan(const char *directory) char name[B_FILE_NAME_LENGTH]; entry.GetName(name); - if (strcmp(name, "ps2")==0) + if (strcmp(name, "ps2") == 0) found_ps2 = true; - if (strcmp(name,"serial")==0 && found_ps2) + if (strcmp(name,"serial") == 0 && found_ps2) continue; if (entry.IsDirectory()) @@ -432,14 +433,20 @@ get_short_name(const char *longName) { BString string(longName); BString name; - + int32 slash = string.FindLast("/"); string.CopyInto(name, slash + 1, string.Length() - slash); int32 index = atoi(name.String()) + 1; - + int32 previousSlash = string.FindLast("/", slash); - string.CopyInto(name, previousSlash + 1, slash - previousSlash - 1); + string.CopyInto(name, previousSlash + 1, slash - previousSlash - 1); + + if (name == "ps2") + name = "PS/2"; + else + name.Capitalize(); + name << " Mouse " << index; - + return strdup(name.String()); }