3 * test handling wakeup events on fd.
4 * You will need to strace things and watch to get any real
5 * feedback as this only does anything interesting when there
8 * Copyright (C) 2011 Neil Brown <neilb@suse.de>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
31 void read_event(int fd, short ev, void *data)
37 printf("Can read now .. give it a moment though\n");
39 n = read(fd, buf, 80);
43 for (i = 0; i < n ; i++)
44 printf(" %02x", buf[i] & 0xff);
48 main(int argc, char *argv[])
54 fprintf(stderr, "Usage: event_test devicename\n");
57 fd = open(argv[1], O_RDONLY);
64 event_priority_init(3);
65 ev = wake_set(fd, read_event, NULL, 1);