On Saturday 24 September 2005 10:56, Denis Oliver Kropp wrote:
> Quoting Laz:
> > I believe the problem here is that the hardware revision can only be
> > obtained by root so this is hard-coded by Marks patch to 0x11 which works
> > for VT1622A but I'm not sure how much the hwrev is used in the code. It
> > looks like the main is is to test whether it is 0x10 or greater. Not sure
> > of hte best way of getting round this: I don't like running stuff as root
> > unless it _really_ needs to!
>
> There should be a small tool to determine the revision and set it in
> directfbrc.

This is what I cobbled together from the DirectFB unichrome driver to 
determine my revision number:

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>

void main ()
{
    char  *filename = "/proc/bus/pci/00/00.0";
    int   fd;
    int   val;
    unsigned char reg = 0xf6;

    fd = open( filename, O_RDONLY );
    if (fd < 0) {
        printf( "DirectFB/Unichrome: Error opening `%s'!\n", filename );
        exit(0);
    }

    if (lseek( fd, reg, SEEK_SET ) == reg) {
        if (read( fd, &val, 1 ) == 1) {
            close( fd );
            printf("Revision = 0x%x\n", val);
            exit(0);
        } else {
            printf("Error reading revision number: needs to run as root!\n");
        }
    }

    close( fd );
}

Something similar could be used to set a value for 'unichrome-rev-no', or 
similar, in /etc/directfbrc. It needs a fall-back value or error message if 
not set, though. Just looking through to see where it gets parsed...

Cheers,

Laz

_______________________________________________
directfb-users mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users

Reply via email to