Project

General

Profile

Download (2.24 KB) Statistics
| Branch: | Tag: | Revision:
1 4c1c0deb (no author)
#ifndef _AUSB_H
2
#define _AUSB_H
3
4
/* Wrapper/Extension code to libusb-0.1 to support asynchronous requests
5
 * on Linux platforns 
6
 *
7
 * (C) 2004 by Harald Welte <laforge@gnumonks.org>
8
 *
9
 * Distributed under the terms of GNU LGPL, Version 2.1
10
 */
11
12 e73b417c meri
#ifndef __user
13
#define __user
14
#endif/*__user*/
15 4c1c0deb (no author)
16
#include <usb.h>
17
#include <linux/usbdevice_fs.h>
18
19
#define AUSB_USBDEVFS_URB_TYPES	4
20
21
/* structures */
22
struct ausb_callback {
23
	void (*handler)(struct usbdevfs_urb *uurb, void *userdata);
24
	void *userdata;
25
};
26
27
struct ausb_dev_handle {
28
	usb_dev_handle *uh;
29
	struct ausb_callback cb[AUSB_USBDEVFS_URB_TYPES];
30
};
31
32
typedef struct ausb_dev_handle ausb_dev_handle;
33
34
/* intitialization */ 
35
int ausb_init(void);
36
ausb_dev_handle *ausb_open(struct usb_device *dev);
37
int ausb_close(ausb_dev_handle *ah);
38
int ausb_register_callback(ausb_dev_handle *ah, unsigned char type,
39
			   void (*callback)(struct usbdevfs_urb *uurb,
40
					    void *userdata),
41
			   void *userdata);
42
43
/* asynchronous URB related functions */
44
void ausb_dump_urb(struct usbdevfs_urb *uurb);
45
void ausb_fill_int_urb(struct usbdevfs_urb *uurb, unsigned char endpoint,
46
		      void *buffer, int buffer_length);
47
int ausb_submit_urb(ausb_dev_handle *ah, struct usbdevfs_urb *uurb);
48
int ausb_discard_urb(ausb_dev_handle *ah, struct usbdevfs_urb *uurb);
49
struct usbdevfs_urb *ausb_get_urb(ausb_dev_handle *ah);
50
51
/* synchronous functions, mostly wrappers for libusb */
52
int ausb_claim_interface(ausb_dev_handle *ah, int interface);
53
int ausb_release_interface(ausb_dev_handle *ah, int interface);
54
int ausb_set_configuration(ausb_dev_handle *dev, int configuration);
55
int ausb_clear_halt(ausb_dev_handle *dev, unsigned int ep);
56
int ausb_reset(ausb_dev_handle *dev);
57
int ausb_resetep(ausb_dev_handle *dev, int ep);
58
int ausb_bulk_write(ausb_dev_handle *ah, int ep, char *bytes, int size, 
59
		    int timeout);
60
int ausb_bulk_read(ausb_dev_handle *ah, int ep, char *bytes, int size, 
61
		   int timeout);
62
#ifdef LIBUSB_HAS_GET_DRIVER_NP
63
int ausb_get_driver_np(ausb_dev_handle *ah, int interface, char *name,
64
		       unsigned int namelen);
65
#endif
66
#ifdef LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP
67
int ausb_detach_kernel_driver_np(ausb_dev_handle *dev, int interface);
68
int ausb_reattach_kernel_driver_np(ausb_dev_handle *dev, int interface);
69
#endif
70
71
#endif /* _AUSB_H */
Add picture from clipboard (Maximum size: 48.8 MB)