bin: Add screen_info command
* Provides basic information on attached BScreen's * Only shows B_MAIN_SCREEN_ID at the moment as that's all we have available.
This commit is contained in:
@@ -117,6 +117,7 @@ StdBinCommands
|
||||
hey.cpp
|
||||
reindex.cpp
|
||||
resattr.cpp
|
||||
screen_info.cpp
|
||||
setarch.cpp
|
||||
setdecor.cpp
|
||||
settype.cpp
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright 2013-2014 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Alexander von Gluck IV <[email protected]>
|
||||
*/
|
||||
|
||||
|
||||
#include <Screen.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
// screen_id currently locked to 1 screen
|
||||
// TODO: This should likely be provided by our API
|
||||
#define MAX_SCREENS 1
|
||||
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
for (int id = 0; id < MAX_SCREENS; id++) {
|
||||
screen_id screenIndex = {id};
|
||||
BScreen screen(screenIndex);
|
||||
accelerant_device_info info;
|
||||
|
||||
// At the moment, screen.ID() is always 0;
|
||||
printf("Screen %d:", screen.ID());
|
||||
if (screen.GetDeviceInfo(&info) != B_OK) {
|
||||
printf(" unavailable\n");
|
||||
} else {
|
||||
printf(" attached\n");
|
||||
printf(" version: %u\n", info.version);
|
||||
printf(" name: %s\n", info.name);
|
||||
printf(" chipset: %s\n", info.chipset);
|
||||
printf(" serial: %s\n", info.serial_no);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user