Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include <stdio.h>
00013 #include <stdlib.h>
00014
00015 #include "REL_Linux_SUSI.H"
00016
00017
00018
00019
00020 int show_platform_info(void)
00021 {
00022 int result;
00023 DWORD major, minor, year, month, date;
00024 const int BUF_LENGTH = 128;
00025 TCHAR buf[BUF_LENGTH];
00026
00027 SusiDllGetVersion(&major, &minor);
00028 year = minor/10000;
00029 month = minor%10000/100;
00030 date = minor%100;
00031 printf("Version: %li (20%02li/%02li/%02li)\n", major, year, month, date);
00032
00033
00034 result = SusiGetPlatformName(buf, BUF_LENGTH);
00035 if (result < 0) {
00036 printf("SusiGetPlatformName() failed\n");
00037 return 1;
00038 }
00039 else if (result > 0) {
00040 printf("SusiGetPlatformName(): buffer is too short\n");
00041 return 1;
00042 }
00043 else
00044 printf("Platform name: %s\n", buf);
00045
00046
00047 result = SusiGetBIOSVersion(buf, BUF_LENGTH);
00048 if (result < 0) {
00049 return 1;
00050 }
00051 else if (result > 0) {
00052 printf("SusiGetBIOSVersion(): buffer is too short\n");
00053 return 1;
00054 }
00055 else
00056 printf("BIOS version: %s\n", buf);
00057
00058 return 0;
00059 }
00060
00061 void show_menu(void)
00062 {
00063 printf("\n");
00064 printf("0) Terminate this program\n");
00065 printf("1) Turn on the screen\n");
00066 printf("2) Turn off the screen\n");
00067 printf("Enter your choice: ");
00068 }
00069
00070 int main(void)
00071 {
00072 int result;
00073 int done, op;
00074
00075 result = SusiDllInit();
00076 if (result == FALSE) {
00077 printf("SusiDllInit() failed\n");
00078 return 1;
00079 }
00080
00081 result = SusiVCAvailable();
00082 if ((result & VC_VGA_CTL_SUPPORT) == 0) {
00083 printf("SusiVCAvailable() = %d failed\n", result);
00084 SusiDllUnInit();
00085 return 1;
00086 }
00087
00088 result = show_platform_info();
00089
00090 done = 0;
00091 while (! done) {
00092 show_menu();
00093 if (scanf("%i", &op) <= 0)
00094 op = -1;
00095
00096 switch (op) {
00097 case 0:
00098 done = 1;
00099 continue;
00100 case 1:
00101 result = SusiVCScreenOn();
00102 break;
00103 case 2:
00104 result = SusiVCScreenOff();
00105 break;
00106 default:
00107 printf("\nUnknown choice!\n\n");
00108 continue;
00109 }
00110 if (result == FALSE) {
00111 SusiDllUnInit();
00112 return 1;
00113 }
00114 }
00115
00116 result = SusiDllUnInit();
00117 if (result == FALSE) {
00118 printf("SusiDllUnInit() failed\n");
00119 return 1;
00120 }
00121
00122 return 0;
00123 }
00124