Some minor visual improvements: the keyboard input device now reports

"AT Keyboard" and "USB Keyboard", instead of "at|usb Keyboard".
Also, the mouse input device now reports a "PS/2 Mouse" instead of
a "ps2 Mouse".
Generally, both now capitalize the device name when reporting the name.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12465 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-04-25 14:17:57 +00:00
parent 7b58474a09
commit 497d01f0b9
2 changed files with 25 additions and 11 deletions
@@ -792,6 +792,13 @@ KeyboardInputDevice::GetShortName(const char *longName)
int32 previousSlash = string.FindLast("/", slash); 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; name << " Keyboard " << index;
return strdup(name.String()); return strdup(name.String());
@@ -404,7 +404,8 @@ mouse_device::~mouse_device()
void void
MouseInputDevice::RecursiveScan(const char *directory) MouseInputDevice::RecursiveScan(const char *directory)
{ {
CALLED(); CALLED();
bool found_ps2 = false; bool found_ps2 = false;
BEntry entry; BEntry entry;
BDirectory dir(directory); BDirectory dir(directory);
@@ -414,9 +415,9 @@ MouseInputDevice::RecursiveScan(const char *directory)
char name[B_FILE_NAME_LENGTH]; char name[B_FILE_NAME_LENGTH];
entry.GetName(name); entry.GetName(name);
if (strcmp(name, "ps2")==0) if (strcmp(name, "ps2") == 0)
found_ps2 = true; found_ps2 = true;
if (strcmp(name,"serial")==0 && found_ps2) if (strcmp(name,"serial") == 0 && found_ps2)
continue; continue;
if (entry.IsDirectory()) if (entry.IsDirectory())
@@ -439,6 +440,12 @@ get_short_name(const char *longName)
int32 previousSlash = string.FindLast("/", slash); 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; name << " Mouse " << index;
return strdup(name.String()); return strdup(name.String());