bthidd.h (137868) | bthidd.h (162128) |
---|---|
1/* 2 * bthidd.h | 1/* 2 * bthidd.h |
3 * 4 * Copyright (c) 2004 Maksim Yevmenkin <m_evmenkin@yahoo.com> | 3 */ 4 5/*- 6 * Copyright (c) 2006 Maksim Yevmenkin <m_evmenkin@yahoo.com> |
5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright --- 7 unchanged lines hidden (view full) --- 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * | 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 1. Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 2. Redistributions in binary form must reproduce the above copyright --- 7 unchanged lines hidden (view full) --- 22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 * |
28 * $Id: bthidd.h,v 1.6 2004/11/17 21:59:42 max Exp $ 29 * $FreeBSD: head/usr.sbin/bluetooth/bthidd/bthidd.h 137868 2004-11-18 18:05:15Z emax $ | 30 * $Id: bthidd.h,v 1.7 2006/09/07 21:06:53 max Exp $ 31 * $FreeBSD: head/usr.sbin/bluetooth/bthidd/bthidd.h 162128 2006-09-07 21:47:49Z emax $ |
30 */ 31 32#ifndef _BTHIDD_H_ 33#define _BTHIDD_H_ 1 34 35#define BTHIDD_IDENT "bthidd" 36#define BTHIDD_PIDFILE "/var/run/" BTHIDD_IDENT ".pid" 37 38struct bthid_session; 39 40struct bthid_server 41{ 42 bdaddr_t bdaddr; /* local bdaddr */ | 32 */ 33 34#ifndef _BTHIDD_H_ 35#define _BTHIDD_H_ 1 36 37#define BTHIDD_IDENT "bthidd" 38#define BTHIDD_PIDFILE "/var/run/" BTHIDD_IDENT ".pid" 39 40struct bthid_session; 41 42struct bthid_server 43{ 44 bdaddr_t bdaddr; /* local bdaddr */ |
43 int cons; /* /dev/consolectl */ 44 int vkbd; /* /dev/vkbdctl */ 45 char const *script; /* keyboard switching script */ 46 int windex; /* wired keyboard index */ 47 bitstr_t *keys; /* pressed keys map */ 48 int ctrl; /* control channel (listen) */ 49 int intr; /* intr. channel (listen) */ 50 int maxfd; /* max fd in sets */ | 45 int32_t cons; /* /dev/consolectl */ 46 int32_t ctrl; /* control channel (listen) */ 47 int32_t intr; /* intr. channel (listen) */ 48 int32_t maxfd; /* max fd in sets */ |
51 fd_set rfdset; /* read descriptor set */ 52 fd_set wfdset; /* write descriptor set */ 53 LIST_HEAD(, bthid_session) sessions; 54}; 55 56typedef struct bthid_server bthid_server_t; 57typedef struct bthid_server * bthid_server_p; 58 59struct bthid_session 60{ 61 bthid_server_p srv; /* pointer back to server */ | 49 fd_set rfdset; /* read descriptor set */ 50 fd_set wfdset; /* write descriptor set */ 51 LIST_HEAD(, bthid_session) sessions; 52}; 53 54typedef struct bthid_server bthid_server_t; 55typedef struct bthid_server * bthid_server_p; 56 57struct bthid_session 58{ 59 bthid_server_p srv; /* pointer back to server */ |
62 int ctrl; /* control channel */ 63 int intr; /* interrupt channel */ | 60 int32_t ctrl; /* control channel */ 61 int32_t intr; /* interrupt channel */ 62 int32_t vkbd; /* virual keyboard */ |
64 bdaddr_t bdaddr;/* remote bdaddr */ | 63 bdaddr_t bdaddr;/* remote bdaddr */ |
65 short state; /* session state */ | 64 uint16_t state; /* session state */ |
66#define CLOSED 0 67#define W4CTRL 1 68#define W4INTR 2 69#define OPEN 3 | 65#define CLOSED 0 66#define W4CTRL 1 67#define W4INTR 2 68#define OPEN 3 |
70 bitstr_t *keys; /* pressed keys map */ | 69 bitstr_t *keys1; /* keys map (new) */ 70 bitstr_t *keys2; /* keys map (old) */ |
71 LIST_ENTRY(bthid_session) next; /* link to next */ 72}; 73 74typedef struct bthid_session bthid_session_t; 75typedef struct bthid_session * bthid_session_p; 76 | 71 LIST_ENTRY(bthid_session) next; /* link to next */ 72}; 73 74typedef struct bthid_session bthid_session_t; 75typedef struct bthid_session * bthid_session_p; 76 |
77int server_init (bthid_server_p srv); | 77int32_t server_init (bthid_server_p srv); |
78void server_shutdown (bthid_server_p srv); | 78void server_shutdown (bthid_server_p srv); |
79int server_do (bthid_server_p srv); | 79int32_t server_do (bthid_server_p srv); |
80 | 80 |
81int client_rescan (bthid_server_p srv); 82int client_connect (bthid_server_p srv, int fd); | 81int32_t client_rescan (bthid_server_p srv); 82int32_t client_connect (bthid_server_p srv, int fd); |
83 | 83 |
84bthid_session_p session_open (bthid_server_p srv, bdaddr_p bdaddr); | 84bthid_session_p session_open (bthid_server_p srv, hid_device_p const d); |
85bthid_session_p session_by_bdaddr(bthid_server_p srv, bdaddr_p bdaddr); | 85bthid_session_p session_by_bdaddr(bthid_server_p srv, bdaddr_p bdaddr); |
86bthid_session_p session_by_fd (bthid_server_p srv, int fd); | 86bthid_session_p session_by_fd (bthid_server_p srv, int32_t fd); |
87void session_close (bthid_session_p s); 88 | 87void session_close (bthid_session_p s); 88 |
89int hid_control (bthid_session_p s, char *data, int len); 90int hid_interrupt (bthid_session_p s, char *data, int len); | 89int32_t hid_control (bthid_session_p s, uint8_t *data, int32_t len); 90int32_t hid_interrupt (bthid_session_p s, uint8_t *data, int32_t len); |
91 92#endif /* ndef _BTHIDD_H_ */ 93 | 91 92#endif /* ndef _BTHIDD_H_ */ 93 |