mac80211: fix compile on linux 2.6.35
[openwrt.git] / package / libtapi / src / tapidemo.c
1
2 #include <stdbool.h>
3 #include <stdlib.h>
4 #include <stdio.h>
5 #include <sys/ioctl.h>
6 #include <fcntl.h>
7 #include <errno.h>
8 #include <poll.h>
9
10 #include <linux/input.h>
11 /*#include <sys/timerfd.h>*/
12 #include "timerfd.h"
13 #include "dialdetector.h"
14
15 #include "tapi-ioctl.h"
16
17 #include "tapi-device.h"
18 #include "tapi-port.h"
19
20 static struct tapi_device dev;
21 static struct tapi_port ports[2];
22
23 void dial_callback(struct tapi_port *port, size_t num_digits, const unsigned char *digits)
24 {
25 unsigned int link;
26
27 if (num_digits != 1)
28 return;
29 if (port->id == digits[0] || digits[0] > 1)
30 return;
31
32 tapi_port_set_ring(&ports[digits[0]], true);
33
34 tapi_session_alloc(&dev, port, &ports[digits[0]]);
35 }
36
37 int main(int argc, char *argv[])
38 {
39 struct dialdetector *dd, *dd2;
40 unsigned int link;
41 unsigned char buf[1024];
42 int ret;
43
44 tapi_device_open(0, &dev);
45 tapi_port_open(0, 0, &ports[0]);
46 tapi_port_open(0, 1, &ports[1]);
47
48 dd = dialdetector_alloc(&ports[0]);
49 dd->dial_callback = dial_callback;
50 dd2 = dialdetector_alloc(&ports[1]);
51 dd2->dial_callback = dial_callback;
52
53 tapi_mainloop();
54
55 return 0;
56 }
This page took 0.05189 seconds and 5 git commands to generate.