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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
|
/**
* (c) 2003 Nathan Hjelm <hjelmn@unm.edu>
* v1.4 driver.h
*
* usb drivers header file
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library 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 Library Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
#if !defined (_DRIVER_H)
#define _DRIVER_H
#include "config.h"
#include "rio.h"
/* supported rio devices */
#define VENDOR_DIAMOND01 0x045a
/* flash players */
#define PRODUCT_RIO600 0x5001
#define PRODUCT_RIO800 0x5002
#define PRODUCT_PSAPLAY 0x5003
#define PRODUCT_RIOS10 0x5005
#define PRODUCT_RIOS50 0x5006
#define PRODUCT_RIOS35 0x5007
#define PRODUCT_RIO900 0x5008
#define PRODUCT_RIOS30 0x5009
#define PRODUCT_FUSE 0x500d
#define PRODUCT_CHIBA 0x500e
#define PRODUCT_CALI 0x500f
#define PRODUCT_RIOS11 0x5010
/* hard drive players */
#define PRODUCT_RIORIOT 0x5202
/* I and read are device->computer.
O and write are computer->device. */
struct player_device_info {
int vendor_id;
int product_id;
int iep;
int oep;
int type;
};
static struct player_device_info player_devices[] = {
/* Rio 600/800/900 and Nike psa[play Use bulk endpoint 2 for read/write */
{VENDOR_DIAMOND01, PRODUCT_RIO600 , 0x2, 0x2, RIO600 },
{VENDOR_DIAMOND01, PRODUCT_RIO800 , 0x2, 0x2, RIO800 },
{VENDOR_DIAMOND01, PRODUCT_PSAPLAY, 0x2, 0x2, PSAPLAY },
{VENDOR_DIAMOND01, PRODUCT_RIO900 , 0x2, 0x2, RIO900 },
/* Rio S-Series Uses bulk endpoint 2 for read and 1 for write */
{VENDOR_DIAMOND01, PRODUCT_RIOS30 , 0x1, 0x2, RIOS30 },
{VENDOR_DIAMOND01, PRODUCT_RIOS35 , 0x1, 0x2, RIOS35 },
{VENDOR_DIAMOND01, PRODUCT_RIOS10 , 0x1, 0x2, RIOS10 },
{VENDOR_DIAMOND01, PRODUCT_RIOS50 , 0x1, 0x2, RIOS50 },
{VENDOR_DIAMOND01, PRODUCT_FUSE , 0x1, 0x2, RIOFUSE },
{VENDOR_DIAMOND01, PRODUCT_CHIBA , 0x1, 0x2, RIOCHIBA },
{VENDOR_DIAMOND01, PRODUCT_CALI , 0x1, 0x2, RIOCALI },
{VENDOR_DIAMOND01, PRODUCT_RIOS11 , 0x1, 0x2, RIOS11 },
/* Rio Riot Uses bulk endpoint 1 for read and 2 for write */
{VENDOR_DIAMOND01, PRODUCT_RIORIOT, 0x2, 0x1, RIORIOT },
{0}
};
struct rioutil_usbdevice {
void *dev;
struct player_device_info *entry;
};
/* defined for WITH_USBDEVFS below */
#if defined(WITH_USBDEVFS)
#include <asm/types.h>
struct usb_device_descriptor_x {
__u8 bLength;
__u8 bDescriptorType;
__u8 bcdUSB[2];
__u8 bDeviceClass;
__u8 bDeviceSubClass;
__u8 bDeviceProtocol;
__u8 bMaxPacketSize0;
__u8 idVendor[2];
__u8 idProduct[2];
__u8 bcdDevice[2];
__u8 iManufacturer;
__u8 iProduct;
__u8 iSerialNumber;
__u8 bNumConfigurations;
};
#include "usbdevfs.h"
static char driver_method[] = "usbdevfs";
/* END -- defined WITH_USBDEVFS */
/* defined for WITH_LIBUSB below */
#elif defined(WITH_LIBUSB)
#include <usb.h>
static char driver_method[] = "libusb";
/* END -- defined WITH_LIBUSB */
/* defined for MacOSX below */
#elif defined(__MacOSX__)
#include <IOKit/IOCFBundle.h>
#include <IOKit/usb/IOUSBLib.h>
struct usbdevice {
IOUSBDeviceInterface182 **device;
IOUSBInterfaceInterface183 **interface;
};
#include <machine/types.h>
static char driver_method[] = "OS X";
/* END -- defined MacOSX */
/* default driver definitions */
#else
static char driver_method[] = "built-in";
#endif
#include "rio_usb.h"
int usb_open_rio (rios_t *rio, int number);
void usb_close_rio (rios_t *rio);
int read_bulk (rios_t *rio, unsigned char *buffer, u_int32_t size);
int write_bulk (rios_t *rio, unsigned char *buffer, u_int32_t size);
int control_msg(rios_t *rio, u_int8_t direction, u_int8_t request,
u_int16_t value, u_int16_t index, u_int16_t length,
unsigned char *buffer);
void usb_setdebug(int);
#endif
|