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

View File

@ -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());
}

View File

@ -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());
}