xref: /haiku/src/bin/screeninfo.cpp (revision ca8ed5ea660fb6275799a3b7f138b201c41a667b)
1 /*
2  * Copyright 2013-2014 Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Alexander von Gluck IV <kallisti5@unixzen.com>
7  */
8 
9 
10 #include <Application.h>
11 #include <Screen.h>
12 #include <stdio.h>
13 
14 
15 // screen_id currently locked to 1 screen
16 // TODO: This should likely be provided by our API
17 #define MAX_SCREENS 1
18 
19 
20 int
21 main()
22 {
23 	// BScreen usage requires BApplication for AppServerLink
24 	BApplication app("application/x-vnd.Haiku-screen_info");
25 
26 	for (int id = 0; id < MAX_SCREENS; id++) {
27 		screen_id screenIndex = {id};
28 		BScreen screen(screenIndex);
29 		accelerant_device_info info;
30 
31 		// At the moment, screen.ID() is always 0;
32 		printf("Screen %" B_PRId32 ":", screen.ID().id);
33 		if (screen.GetDeviceInfo(&info) != B_OK) {
34 			printf(" unavailable\n");
35 		} else {
36 			printf(" attached\n");
37 			printf("  version: %u\n", info.version);
38 			printf("  name:    %s\n", info.name);
39 			printf("  chipset: %s\n", info.chipset);
40 			printf("  serial:  %s\n", info.serial_no);
41 		}
42 	}
43 
44 	return 0;
45 }
46