File: usbdrv.h

package info (click to toggle)
rioutil 1.4.4-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,980 kB
  • ctags: 777
  • sloc: sh: 11,429; ansic: 5,834; makefile: 112
file content (94 lines) | stat: -rw-r--r-- 3,693 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*****************************************************************************/

/*
 *	usbdrv.h  --  Linux USB driver interface.
 *
 *	Copyright (C) 1999-2000
 *          Thomas Sailer (sailer@ife.ee.ethz.ch)
 *
 *	This program is free software; you can redistribute it and/or modify
 *	it under the terms of the GNU General Public License as published by
 *	the Free Software Foundation; either version 2 of the License, or
 *	(at your option) any later version.
 *
 *	This program is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *	GNU General Public License for more details.
 *
 *	You should have received a copy of the GNU General Public License
 *	along with this program; if not, write to the Free Software
 *	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 *  Please note that the GPL allows you to use the driver, NOT the radio.
 *  In order to use the radio, you need a license from the communications
 *  authority of your country.
 *
 *  $Id: usbdrv.h,v 1.4 2003/08/06 15:56:25 hjelmn Exp $	 
 *
 *  History:
 *   0.1  07.01.2000  Created
 *
 */

/*****************************************************************************/

#ifndef _USBDRV_H
#define _USBDRV_H

/* --------------------------------------------------------------------- */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#define _GNU_SOURCE
#include <sys/types.h>
#include <stdio.h>

#include "driver.h"

struct usbdevice {
  int fd;
  struct usb_device_descriptor_x desc;
};

#ifdef HAVE_LINUX_USBDEVICE_FS_H
#include <linux/types.h>
#include <linux/usbdevice_fs.h>
#else
#include <linux/types.h>
#include "usbdevice_fs.h"
#endif

/* --------------------------------------------------------------------- */


//#define USB_DT_DEVICE_SIZE sizeof(struct usb_device_descriptor)

/* --------------------------------------------------------------------- */

extern char const *usb_devicefs_mountpoint;

extern void riousb_show_device_descriptor(FILE *f, struct usb_device_descriptor *desc);
extern void riousb_close(struct usbdevice *dev);
extern struct usbdevice *riousb_open_bynumber(unsigned int busnum, unsigned int devnum, int vendorid, int productid);
extern struct usbdevice *riousb_open(int vendorid, int productid, unsigned int timeout);
extern int riousb_control_msg(struct usbdevice *dev, unsigned char requesttype, unsigned char request,
			  unsigned short value, unsigned short index, unsigned short length, void *data, unsigned int timeout);
extern int riousb_bulk_msg(struct usbdevice *dev, unsigned int ep, unsigned int dlen, void *data, unsigned int timeout);
extern int riousb_resetep(struct usbdevice *dev, unsigned int ep);
extern int riousb_reset(struct usbdevice *dev);
extern int riousb_setconfiguration(struct usbdevice *dev, unsigned int configuration);
extern int riousb_setinterface(struct usbdevice *dev, unsigned int intf, unsigned int altsetting);
extern int riousb_getdevicedescriptor(struct usbdevice *dev, struct usb_device_descriptor *desc);
extern int riousb_claiminterface(struct usbdevice *dev, unsigned int intf);
extern int riousb_releaseinterface(struct usbdevice *dev, unsigned int intf);
extern int riousb_discsignal(struct usbdevice *dev, unsigned int signr, void *context);
extern int riousb_submiturb(struct usbdevice *dev, struct usbdevfs_urb *urb);
extern int riousb_discardurb(struct usbdevice *dev, struct usbdevfs_urb *urb);
extern struct usbdevfs_urb *riousb_reapurb(struct usbdevice *dev, unsigned int nonblock);


/* --------------------------------------------------------------------- */
#endif /* _USBDRV_H */