From: Tormod Volden <[email protected]> Otherwise print "unknown" for dac and backlight status.
Signed-off-by: Tormod Volden <[email protected]> --- radeontool.c | 24 ++++++++++++++++++------ 1 files changed, 18 insertions(+), 6 deletions(-) diff --git a/radeontool.c b/radeontool.c index cb7f051..f9710fc 100644 --- a/radeontool.c +++ b/radeontool.c @@ -26,13 +26,15 @@ #include "radeon_reg.h" +static void map_radeon_cntl_mem(void); + int debug = 0; int skip = 0; /* *radeon_cntl_mem is mapped to the actual device's memory mapped control area. */ /* Not the address but what it points to is volatile. */ struct pci_device *avivo_device = NULL; -unsigned char * volatile radeon_cntl_mem; +unsigned char * volatile radeon_cntl_mem = NULL; int ctrl_region = -1, fb_region = -1; unsigned char * volatile fb_mem; unsigned char * volatile ctrl_mem; @@ -141,13 +143,24 @@ static void radeon_set_mcind(unsigned long offset, const char *name, static void usage(void) { + const char *dac_status = "unknown"; + const char *light_status = "unknown"; + + if (geteuid() == 0) { + if (radeon_cntl_mem == NULL) + map_radeon_cntl_mem(); + dac_status = (radeon_get(RADEON_DAC_CNTL, "RADEON_DAC_CNTL") + & RADEON_DAC_PDWN) ? "off" : "on"; + light_status = (radeon_get(RADEON_LVDS_GEN_CNTL, "RADEON_LVDS_GEN_CNTL") + & RADEON_LVDS_ON) ? "on" : "off"; + } fprintf(stderr,"usage: radeontool [options] [command]\n"); fprintf(stderr," --debug - show a little debug info\n"); fprintf(stderr," --skip=1 - use the second radeon card\n"); - fprintf(stderr," dac [on|off] - power down the external video outputs (%s)\n", - (radeon_get(RADEON_DAC_CNTL,"RADEON_DAC_CNTL")&RADEON_DAC_PDWN)?"off":"on"); - fprintf(stderr," light [on|off] - power down the backlight (%s)\n", - (radeon_get(RADEON_LVDS_GEN_CNTL,"RADEON_LVDS_GEN_CNTL")&RADEON_LVDS_ON)?"on":"off"); + fprintf(stderr," dac [on|off] - power down the external " + "video outputs (%s)\n", dac_status); + fprintf(stderr," light [on|off] - power down the backlight " + "(%s)\n", light_status); fprintf(stderr," stretch [on|off|vert|horiz|auto|manual] - stretching for resolution mismatch \n"); fprintf(stderr," regs - show a listing of some random registers\n"); fprintf(stderr," regmatch <pattern> - show registers matching wildcard pattern\n"); @@ -2954,7 +2967,6 @@ int main(int argc,char *argv[]) if (geteuid() != 0) fprintf(stderr, "Warning: Need root privileges to access hardware\n"); if(argc == 1) { - map_radeon_cntl_mem(); usage(); } while (argc >= 2) { -- 1.7.5.4 _______________________________________________ xorg-driver-ati mailing list [email protected] http://lists.x.org/mailman/listinfo/xorg-driver-ati
