[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] Brug af "input" laget



On Fri, 2006-03-03 at 16:29 +0100, Henrik Bork Steffensen wrote:

> Hvis jeg lige skulle udybe problemstillingen lidt...:
> jeg kan godt hente events fra /dev/input/mice - men de data jeg læser er 
> ren garbarge og det er her jeg ikke kan finde nogen nyttig dokumentation.

Data kommer i blokke á 3 byte. Helt hvor jeg har læst det henne kan jeg
ikke huske, men det skulle være nogenlunde nedenstående:

typedef struct mousebuf{
        unsigned char but;
        unsigned char horz;
        unsigned char vert;
} ;

#define BUT_LEFT  0x01 | 0x08
#define BUT_RIGHT 0x02 | 0x08
#define BUT_MID   0x04 | 0x08

mousebuf mbuf;

fd = open("/dev/input/mice", O_RDONLY);
size = read(fd, &mbuf, sizeof(mbuf));
if (size == sizeof(mbuf)) {
   printf("but: 0x%02x x:%d y:%d\n", mbuf.but & 0x0F, mbuf.horz,
mbuf.vert);
}


/hans
-- 
FHS: "/usr is shareable, read-only data."
Then run this command: rm -rf /usr/local/{etc,var}



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2006-04-01, 02:01 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *