[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: PBButtonsd gatwick IRQ



Am Freitag, 28. Mai 2004 02:56 schrieb Zach Weinberg:
> Also, When my computer is not plugged into AC it goes into sleep at the
> time given in /etc/pbbuttonsd.conf  even while im worknig on it. This
> problem is unrelated, but if anyone could help with either of these, I
> would extremely grateful.

Hi,
I assume you use the internal keyboard and not an external one?

Do you have the event devices installed? Please use the attached
program cev (compile with gcc -Wall -o cev cev.c). It will scan the
event devices and displays what it has found. Please check if there
is any keyboard in the list.

If anything is all right till this point please replace the attached include 
file 'debug.h' with that one in your pbbuttonsd source tree and compile
with --enable-debug. Start pbbuttonsd in a console (not as daemon) and watch 
the additional debug output. It shows the keycodes pbbuttonsd receives. Type 
a few keys and see if the keycode value changes.

Tell me your results

  Best Regards
     Matthias

#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <linux/input.h>

#define BITS_PER_LONG (sizeof(long) * 8)
#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
#define OFF(x) ((x)%BITS_PER_LONG)
#define LONG(x) ((x)/BITS_PER_LONG)
#define test_bit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1)

char *events[EV_MAX + 1] = {"Reset", "Key", "Relative", "Absolute",
                             NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
			     NULL, NULL, "LED", "Sound", NULL, "Repeat", "ForceFeedback", NULL,
			     "ForceFeedbackStatus"};

int main(int argc, const char **argv)
{
        int eventfd = -1;
        struct input_event inp;
        short ids[4];
        char filename[20];
	char name[256];
	unsigned long bit[EV_MAX][NBITS(KEY_MAX)];

	int rep=0;
	int i, j;

	for (i = 0; i < 33; i++) {
		sprintf(filename, "/dev/input/event%d", i);
		if (i == 32)
		    eventfd = open("/dev/input/mice", O_RDONLY);
		else
		    eventfd = open(filename, O_RDONLY);
		if (eventfd >= 0) {
			ioctl(eventfd, EVIOCGID, ids);
			printf("[%x] ids - %x %x %x %x", i, ids[0], ids[1], ids[2], ids[3]);
			ioctl(eventfd, EVIOCGNAME(sizeof(name)), name);
			printf("  Name: %s\n", name);
			ioctl(eventfd, EVIOCGBIT(0, EV_MAX), bit[0]);
			printf("  Supported Events:\n  ");
			for(j=0; j < EV_MAX; j++)
			    if (test_bit(j, bit[0]))
			        printf("%d (%s) ", j, events[j] ? events[j] : "?");
			printf("\n");	
			close(eventfd);
			eventfd = -1;
		} else {
			fprintf(stderr, "[%x] nil\n", i);
		}
	}

	eventfd = open("/dev/input/event0", O_RDONLY);
        while (read(eventfd, &inp, sizeof(inp))) {
	    if (rep != ((inp.value << 8) + inp.code)) {
    	        rep = (inp.value << 8) + inp.code;
		printf("\tEvent: type=0x%02x (%d) code=0x%02x (%d) value=0x%02x (%d)\n",
		   inp.type, inp.type, inp.code, inp.code, inp.value, inp.value);
	    }
        }

        close(eventfd);
        return 0;
}
#ifndef INCLUDE_DEBUG_H
#define INCLUDE_DEBUG_H
/* ----------------------------------------------------------------------------
 * debug.h
 * definitions for debugging. This file describes in detail which debug
 * information should be printed to console. The symbol DEBUG must also
 * be defined. It is the master key for all of this options.
 *
 * Copyright 2002 Matthias Grimm
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version
 * 2 of the License, or (at your option) any later version.
 * ----------------------------------------------------------------------------*/

/* module_powersave.c */
#define SLEEPLOCKS    0 /* =1 for printing sleeplock status to console */

/* module_pmac.c */
#define PMUINTR       0 /* =1 for printing PMU interrupts to console */
#define SIMUAMBIENT   0 /* =1 for simulating ambient light sensor */
#define TESTAMBIENT   0 /* =1 for printing some ambient values to console */

/* module_peep.c */
#define PEEP_IPC      0 /* =1, all tags sent to clients will be printed */
#define PEEP_CONFIG   1 /* =1, all configure tags will be printed */
#define PEEP_QUERY    0 /* =1, all query tags will be printed */
#define PEEP_SECURE   0 /* =1, all security tags will be printed */
#define PEEP_KEYBOARD 1 /* =1, keyboard events are printed */
#define PEEP_MOUSE    0 /* =1, mouse events are printed */
#define PEEP_TIMER    0 /* =1, timer events are printed */
#define PEEP_NOCYCLIC 1 /* =1, some cyclic tags will be filtered out */

#endif    /* INCLUDE_MODULE_CDROM_H */


Reply to: