1 /*
2  * device.h
3  *
4  * Copyright (C) 2009 Hector Martin <hector@marcansoft.com>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 2 or version 3.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
18  */
19 
20 #ifndef DEVICE_H
21 #define DEVICE_H
22 
23 #include "usb.h"
24 #include "client.h"
25 
26 struct device_info {
27 	int id;
28 	const char *serial;
29 	uint32_t location;
30 	uint16_t pid;
31 	uint64_t speed;
32 };
33 
34 void device_data_input(struct usb_device *dev, unsigned char *buf, uint32_t length);
35 
36 int device_add(struct usb_device *dev);
37 void device_remove(struct usb_device *dev);
38 
39 int device_start_connect(int device_id, uint16_t port, struct mux_client *client);
40 void device_client_process(int device_id, struct mux_client *client, short events);
41 void device_abort_connect(int device_id, struct mux_client *client);
42 
43 void device_set_visible(int device_id);
44 void device_set_preflight_cb_data(int device_id, void* data);
45 
46 int device_get_count(int include_hidden);
47 int device_get_list(int include_hidden, struct device_info **devices);
48 
49 int device_get_timeout(void);
50 void device_check_timeouts(void);
51 
52 void device_init(void);
53 void device_kill_connections(void);
54 void device_shutdown(void);
55 
56 #endif
57