From: Nicolas B. <nbo...@us...> - 2006-02-23 21:49:01
|
Update of /cvsroot/ddccontrol/ddccontrol/src/ddccontrol In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31930/src/ddccontrol Modified Files: main.c Log Message: Fallback to generic profiles when a monitor is not supported in the database (displaying a big warning inviting the users to send their dumps to ddccontrol-users). Index: main.c =================================================================== RCS file: /cvsroot/ddccontrol/ddccontrol/src/ddccontrol/main.c,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- main.c 23 Feb 2006 12:51:08 -0000 1.30 +++ main.c 23 Feb 2006 21:48:56 -0000 1.31 @@ -81,15 +81,15 @@ } if (controlname == NULL) { fprintf(stdout, "%s 0x%02x: %c/%d/%d %c [???]\n", _("Control"), - ctrl, (result > 0) ? '+' : '-', value, maximum, (monitor->caps[ctrl]) ? 'C' : ' '); + ctrl, (result > 0) ? '+' : '-', value, maximum, (mon->caps.vcp[ctrl]) ? 'C' : ' '); } else if (valuename == NULL) { fprintf(stdout, "%s 0x%02x: %c/%d/%d %c [%s]\n", _("Control"), - ctrl, (result > 0) ? '+' : '-', value, maximum, (monitor->caps[ctrl]) ? 'C' : ' ', controlname); + ctrl, (result > 0) ? '+' : '-', value, maximum, (mon->caps.vcp[ctrl]) ? 'C' : ' ', controlname); } else { fprintf(stdout, "%s 0x%02x: %c/%d/%d %c [%s - %s]\n", _("Control"), - ctrl, (result > 0) ? '+' : '-', value, maximum, (monitor->caps[ctrl]) ? 'C' : ' ', controlname, valuename); + ctrl, (result > 0) ? '+' : '-', value, maximum, (mon->caps.vcp[ctrl]) ? 'C' : ' ', controlname, valuename); } } break; @@ -137,8 +137,11 @@ } strcat(buffer, "))"); + struct caps caps; + ddcci_parse_caps(buffer, &caps, 1); + printf(_("Checking %s integrity...\n"), pnpname); - if (!(mon_db = ddcci_create_db(pnpname, buffer, 0))) { + if (!(mon_db = ddcci_create_db(pnpname, &caps, 0))) { printf(_("[ FAILED ]\n")); ddcci_release_db(); exit(1); @@ -314,15 +317,59 @@ fprintf(stdout, _("\tPlug and Play ID: %s [%s]\n"), mon.pnpid, mon.db ? mon.db->name : NULL); fprintf(stdout, _("\tInput type: %s\n"), mon.digital ? _("Digital") : _("Analog")); - + + if (mon.fallback) { + /* Put a big warning (in red if we are writing to a terminal). */ + printf("%s%s\n", isatty(1) ? "\x1B[5;31m" : "", _("=============================== WARNING ===============================")); + if (mon.fallback == 1) { + printf(_( + "There is no support for your monitor in the database, but ddccontrol is\n" + "using a generic profile for your monitor's manufacturer. Some controls\n" + "may not be supported, or may not work as expected.\n")); + } + else if (mon.fallback == 2) { + printf(_( + "There is no support for your monitor in the database, but ddccontrol is\n" + "using a basic generic profile. Many controls will not be supported, and\n" + "some controls may not work as expected.\n")); + } + printf(_( + "Please update ddccontrol-db, or, if you are already using the latest\n" + "version, please send the output of the following command to\n" + "ddc...@li...:\n")); + printf("\nLANG= LC_ALL= ddccontrol -p -c -d\n\n"); + printf(_("Thank you.\n")); + printf("%s%s\n", _("=============================== WARNING ==============================="), isatty(1) ? "\x1B[0m" : ""); + } + if (caps) { - unsigned char buf[1024]; - fprintf(stdout, _("\nCapabilities:\n")); for (retry = RETRYS; retry; retry--) { - if (ddcci_caps(&mon, buf, 1024) >= 0) { - fprintf(stdout, "%s\n", buf); + if (ddcci_caps(&mon) >= 0) { + fprintf(stdout, _("Raw output: %s\n"), mon.caps.raw_caps); + + fprintf(stdout, _("Parsed output: \n\tVCP: ")); + int i; + for (i = 0; i < 256; i++) { + if (mon.caps.vcp[i]) { + printf("%02x ", i); + } + } + printf("\n"); + printf(_("\tType: ")); + switch(mon.caps.type) { + case lcd: + printf(_("LCD")); + break; + case crt: + printf(_("CRT")); + break; + case unk: + printf(_("Unknown")); + break; + } + printf("\n"); break; } } |