Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
293a4f60
Commit
293a4f60
authored
Jul 10, 2003
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Plain Diff
Merge
bk://kernel.bkbits.net/jgarzik/irda-2.5
into home.osdl.org:/home/torvalds/v2.5/linux
parents
9b32de66
4bec6175
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
1748 additions
and
614 deletions
+1748
-614
MAINTAINERS
MAINTAINERS
+1
-1
drivers/usb/class/usblp.c
drivers/usb/class/usblp.c
+14
-10
drivers/usb/core/inode.c
drivers/usb/core/inode.c
+0
-4
drivers/usb/core/message.c
drivers/usb/core/message.c
+1
-1
drivers/usb/net/usbnet.c
drivers/usb/net/usbnet.c
+1
-1
drivers/usb/serial/ftdi_sio.c
drivers/usb/serial/ftdi_sio.c
+1502
-462
drivers/usb/serial/ftdi_sio.h
drivers/usb/serial/ftdi_sio.h
+149
-41
drivers/usb/storage/datafab.c
drivers/usb/storage/datafab.c
+60
-30
drivers/usb/storage/freecom.c
drivers/usb/storage/freecom.c
+9
-26
drivers/usb/storage/initializers.c
drivers/usb/storage/initializers.c
+9
-27
drivers/usb/storage/unusual_devs.h
drivers/usb/storage/unusual_devs.h
+2
-8
drivers/usb/usb-skeleton.c
drivers/usb/usb-skeleton.c
+0
-3
No files found.
MAINTAINERS
View file @
293a4f60
...
...
@@ -1910,7 +1910,7 @@ L: linux-usb-users@lists.sourceforge.net
L: linux-usb-devel@lists.sourceforge.net
S: Maintained
USB BLUETOOTH DRIVER
USB BLUETOOTH
TTY CONVERTER
DRIVER
P: Greg Kroah-Hartman
M: greg@kroah.com
L: linux-usb-users@lists.sourceforge.net
...
...
drivers/usb/class/usblp.c
View file @
293a4f60
...
...
@@ -146,6 +146,7 @@ struct usblp {
int
rcomplete
;
/* reading is completed */
unsigned
int
quirks
;
/* quirks flags */
unsigned
char
used
;
/* True if open */
unsigned
char
present
;
/* True if not disconnected */
unsigned
char
bidir
;
/* interface is bidirectional */
unsigned
char
*
device_id_string
;
/* IEEE 1284 DEVICE ID string (ptr) */
/* first 2 bytes are (big-endian) length */
...
...
@@ -157,6 +158,7 @@ static void usblp_dump(struct usblp *usblp) {
dbg
(
"usblp=0x%p"
,
usblp
);
dbg
(
"dev=0x%p"
,
usblp
->
dev
);
dbg
(
"present=%d"
,
usblp
->
present
);
dbg
(
"buf=0x%p"
,
usblp
->
buf
);
dbg
(
"readcount=%d"
,
usblp
->
readcount
);
dbg
(
"ifnum=%d"
,
usblp
->
ifnum
);
...
...
@@ -253,7 +255,7 @@ static void usblp_bulk_read(struct urb *urb, struct pt_regs *regs)
{
struct
usblp
*
usblp
=
urb
->
context
;
if
(
!
usblp
||
!
usblp
->
dev
||
!
usblp
->
used
)
if
(
!
usblp
||
!
usblp
->
dev
||
!
usblp
->
used
||
!
usblp
->
present
)
return
;
if
(
unlikely
(
urb
->
status
))
...
...
@@ -267,7 +269,7 @@ static void usblp_bulk_write(struct urb *urb, struct pt_regs *regs)
{
struct
usblp
*
usblp
=
urb
->
context
;
if
(
!
usblp
||
!
usblp
->
dev
||
!
usblp
->
used
)
if
(
!
usblp
||
!
usblp
->
dev
||
!
usblp
->
used
||
!
usblp
->
present
)
return
;
if
(
unlikely
(
urb
->
status
))
...
...
@@ -332,7 +334,7 @@ static int usblp_open(struct inode *inode, struct file *file)
goto
out
;
}
usblp
=
usb_get_intfdata
(
intf
);
if
(
!
usblp
||
!
usblp
->
dev
)
if
(
!
usblp
||
!
usblp
->
dev
||
!
usblp
->
present
)
goto
out
;
retval
=
-
EBUSY
;
...
...
@@ -404,7 +406,7 @@ static int usblp_release(struct inode *inode, struct file *file)
down
(
&
usblp
->
sem
);
lock_kernel
();
usblp
->
used
=
0
;
if
(
usblp
->
dev
)
{
if
(
usblp
->
present
)
{
usblp_unlink_urbs
(
usblp
);
up
(
&
usblp
->
sem
);
}
else
/* finish cleanup from disconnect */
...
...
@@ -432,7 +434,7 @@ static int usblp_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
int
retval
=
0
;
down
(
&
usblp
->
sem
);
if
(
!
usblp
->
dev
)
{
if
(
!
usblp
->
present
)
{
retval
=
-
ENODEV
;
goto
done
;
}
...
...
@@ -630,7 +632,7 @@ static ssize_t usblp_write(struct file *file, const char __user *buffer, size_t
}
down
(
&
usblp
->
sem
);
if
(
!
usblp
->
dev
)
{
if
(
!
usblp
->
present
)
{
up
(
&
usblp
->
sem
);
return
-
ENODEV
;
}
...
...
@@ -691,7 +693,7 @@ static ssize_t usblp_read(struct file *file, char __user *buffer, size_t count,
return
-
EINVAL
;
down
(
&
usblp
->
sem
);
if
(
!
usblp
->
dev
)
{
if
(
!
usblp
->
present
)
{
count
=
-
ENODEV
;
goto
done
;
}
...
...
@@ -726,7 +728,7 @@ static ssize_t usblp_read(struct file *file, char __user *buffer, size_t count,
remove_wait_queue
(
&
usblp
->
wait
,
&
wait
);
}
if
(
!
usblp
->
dev
)
{
if
(
!
usblp
->
present
)
{
count
=
-
ENODEV
;
goto
done
;
}
...
...
@@ -916,6 +918,8 @@ static int usblp_probe(struct usb_interface *intf,
usb_set_intfdata
(
intf
,
usblp
);
usblp
->
present
=
1
;
return
0
;
abort_minor:
...
...
@@ -1115,14 +1119,14 @@ static void usblp_disconnect(struct usb_interface *intf)
down
(
&
usblp
->
sem
);
lock_kernel
();
usblp
->
dev
=
NULL
;
usblp
->
present
=
0
;
usb_set_intfdata
(
intf
,
NULL
);
usblp_unlink_urbs
(
usblp
);
if
(
!
usblp
->
used
)
usblp_cleanup
(
usblp
);
else
/* cleanup later, on
clo
se */
else
/* cleanup later, on
relea
se */
up
(
&
usblp
->
sem
);
unlock_kernel
();
}
...
...
drivers/usb/core/inode.c
View file @
293a4f60
...
...
@@ -491,10 +491,6 @@ static struct file_system_type usbdevice_fs_type;
static
struct
super_block
*
usb_get_sb
(
struct
file_system_type
*
fs_type
,
int
flags
,
const
char
*
dev_name
,
void
*
data
)
{
if
(
fs_type
==
&
usbdevice_fs_type
)
printk
(
KERN_INFO
"Please use the 'usbfs' filetype instead, "
"the 'usbdevfs' name is deprecated.
\n
"
);
return
get_sb_single
(
fs_type
,
flags
,
data
,
usbfs_fill_super
);
}
...
...
drivers/usb/core/message.c
View file @
293a4f60
...
...
@@ -986,7 +986,7 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size)
if
(
err
<
0
)
{
err
(
"error getting string descriptor 0 (error=%d)"
,
err
);
goto
errout
;
}
else
if
(
tbuf
[
0
]
<
4
)
{
}
else
if
(
err
<
4
||
tbuf
[
0
]
<
4
)
{
err
(
"string descriptor 0 too short"
);
err
=
-
EINVAL
;
goto
errout
;
...
...
drivers/usb/net/usbnet.c
View file @
293a4f60
...
...
@@ -2391,7 +2391,7 @@ static int usbnet_start_xmit (struct sk_buff *skb, struct net_device *net)
if
(
retval
)
{
devdbg
(
dev
,
"drop, code %d"
,
retval
);
drop:
retval
=
NET_XMIT_
DROP
;
retval
=
NET_XMIT_
SUCCESS
;
dev
->
stats
.
tx_dropped
++
;
if
(
skb
)
dev_kfree_skb_any
(
skb
);
...
...
drivers/usb/serial/ftdi_sio.c
View file @
293a4f60
This diff is collapsed.
Click to expand it.
drivers/usb/serial/ftdi_sio.h
View file @
293a4f60
...
...
@@ -14,11 +14,12 @@
* of the protocol required to talk to the device and ongoing assistence
* during development.
*
* Bill Ryder - bryder@sgi.com of Silicon Graphics, Inc.- wrote the
* Bill Ryder - bryder@sgi.com
formerly
of Silicon Graphics, Inc.- wrote the
* FTDI_SIO implementation.
*
* Philipp Ghring - pg@futureware.at - added the Device ID of the USB relais
* from Rudolf Gugler
*
*/
#define FTDI_VID 0x0403
/* Vendor Id */
...
...
@@ -28,6 +29,93 @@
#define FTDI_NF_RIC_VID 0x0DCD
/* Vendor Id */
#define FTDI_NF_RIC_PID 0x0001
/* Product Id */
/* www.crystalfontz.com devices - thanx for providing free devices for evaluation ! */
/* they use the ftdi chipset for the USB interface and the vendor id is the same */
#define FTDI_XF_634_PID 0xFC09
/* Four line device */
#define FTDI_XF_632_PID 0xFC08
/* Two line device */
/* Video Networks Limited / Homechoice in the UK use an ftdi-based device for their 1Mb */
/* broadband internet service. The following PID is exhibited by the usb device supplied */
/* (the VID is the standard ftdi vid (FTDI_VID) */
#define FTDI_VNHCPCUSB_D_PID 0xfe38
/* Product Id */
/*
* The following are the values for the Matrix Orbital LCD displays,
* which are the FT232BM ( similar to the 8U232AM )
*/
#define FTDI_MTXORB_VID FTDI_VID
/* Matrix Orbital Product Id */
#define FTDI_MTXORB_0_PID 0xFA00
/* Matrix Orbital Product Id */
#define FTDI_MTXORB_1_PID 0xFA01
/* Matrix Orbital Product Id */
#define FTDI_MTXORB_2_PID 0xFA02
/* Matrix Orbital Product Id */
#define FTDI_MTXORB_3_PID 0xFA03
/* Matrix Orbital Product Id */
#define FTDI_MTXORB_4_PID 0xFA04
/* Matrix Orbital Product Id */
#define FTDI_MTXORB_5_PID 0xFA05
/* Matrix Orbital Product Id */
#define FTDI_MTXORB_6_PID 0xFA06
/* Matrix Orbital Product Id */
/*
* The following are the values for the Sealevel SeaLINK+ adapters.
* (Original list sent by Tuan Hoang. Ian Abbott renamed the macros and
* removed some PIDs that don't seem to match any existing products.)
*/
#define SEALEVEL_VID 0x0c52
/* Sealevel Vendor ID */
#define SEALEVEL_2101_PID 0x2101
/* SeaLINK+232 (2101/2105) */
#define SEALEVEL_2102_PID 0x2102
/* SeaLINK+485 (2102) */
#define SEALEVEL_2103_PID 0x2103
/* SeaLINK+232I (2103) */
#define SEALEVEL_2104_PID 0x2104
/* SeaLINK+485I (2104) */
#define SEALEVEL_2201_1_PID 0x2211
/* SeaPORT+2/232 (2201) Port 1 */
#define SEALEVEL_2201_2_PID 0x2221
/* SeaPORT+2/232 (2201) Port 2 */
#define SEALEVEL_2202_1_PID 0x2212
/* SeaPORT+2/485 (2202) Port 1 */
#define SEALEVEL_2202_2_PID 0x2222
/* SeaPORT+2/485 (2202) Port 2 */
#define SEALEVEL_2203_1_PID 0x2213
/* SeaPORT+2 (2203) Port 1 */
#define SEALEVEL_2203_2_PID 0x2223
/* SeaPORT+2 (2203) Port 2 */
#define SEALEVEL_2401_1_PID 0x2411
/* SeaPORT+4/232 (2401) Port 1 */
#define SEALEVEL_2401_2_PID 0x2421
/* SeaPORT+4/232 (2401) Port 2 */
#define SEALEVEL_2401_3_PID 0x2431
/* SeaPORT+4/232 (2401) Port 3 */
#define SEALEVEL_2401_4_PID 0x2441
/* SeaPORT+4/232 (2401) Port 4 */
#define SEALEVEL_2402_1_PID 0x2412
/* SeaPORT+4/485 (2402) Port 1 */
#define SEALEVEL_2402_2_PID 0x2422
/* SeaPORT+4/485 (2402) Port 2 */
#define SEALEVEL_2402_3_PID 0x2432
/* SeaPORT+4/485 (2402) Port 3 */
#define SEALEVEL_2402_4_PID 0x2442
/* SeaPORT+4/485 (2402) Port 4 */
#define SEALEVEL_2403_1_PID 0x2413
/* SeaPORT+4 (2403) Port 1 */
#define SEALEVEL_2403_2_PID 0x2423
/* SeaPORT+4 (2403) Port 2 */
#define SEALEVEL_2403_3_PID 0x2433
/* SeaPORT+4 (2403) Port 3 */
#define SEALEVEL_2403_4_PID 0x2443
/* SeaPORT+4 (2403) Port 4 */
#define SEALEVEL_2801_1_PID 0X2811
/* SeaLINK+8/232 (2801) Port 1 */
#define SEALEVEL_2801_2_PID 0X2821
/* SeaLINK+8/232 (2801) Port 2 */
#define SEALEVEL_2801_3_PID 0X2831
/* SeaLINK+8/232 (2801) Port 3 */
#define SEALEVEL_2801_4_PID 0X2841
/* SeaLINK+8/232 (2801) Port 4 */
#define SEALEVEL_2801_5_PID 0X2851
/* SeaLINK+8/232 (2801) Port 5 */
#define SEALEVEL_2801_6_PID 0X2861
/* SeaLINK+8/232 (2801) Port 6 */
#define SEALEVEL_2801_7_PID 0X2871
/* SeaLINK+8/232 (2801) Port 7 */
#define SEALEVEL_2801_8_PID 0X2881
/* SeaLINK+8/232 (2801) Port 8 */
#define SEALEVEL_2802_1_PID 0X2812
/* SeaLINK+8/485 (2802) Port 1 */
#define SEALEVEL_2802_2_PID 0X2822
/* SeaLINK+8/485 (2802) Port 2 */
#define SEALEVEL_2802_3_PID 0X2832
/* SeaLINK+8/485 (2802) Port 3 */
#define SEALEVEL_2802_4_PID 0X2842
/* SeaLINK+8/485 (2802) Port 4 */
#define SEALEVEL_2802_5_PID 0X2852
/* SeaLINK+8/485 (2802) Port 5 */
#define SEALEVEL_2802_6_PID 0X2862
/* SeaLINK+8/485 (2802) Port 6 */
#define SEALEVEL_2802_7_PID 0X2872
/* SeaLINK+8/485 (2802) Port 7 */
#define SEALEVEL_2802_8_PID 0X2882
/* SeaLINK+8/485 (2802) Port 8 */
#define SEALEVEL_2803_1_PID 0X2813
/* SeaLINK+8 (2803) Port 1 */
#define SEALEVEL_2803_2_PID 0X2823
/* SeaLINK+8 (2803) Port 2 */
#define SEALEVEL_2803_3_PID 0X2833
/* SeaLINK+8 (2803) Port 3 */
#define SEALEVEL_2803_4_PID 0X2843
/* SeaLINK+8 (2803) Port 4 */
#define SEALEVEL_2803_5_PID 0X2853
/* SeaLINK+8 (2803) Port 5 */
#define SEALEVEL_2803_6_PID 0X2863
/* SeaLINK+8 (2803) Port 6 */
#define SEALEVEL_2803_7_PID 0X2873
/* SeaLINK+8 (2803) Port 7 */
#define SEALEVEL_2803_8_PID 0X2883
/* SeaLINK+8 (2803) Port 8 */
/*
* Home Electronics (www.home-electro.com) USB gadgets
*/
#define FTDI_HE_TIRA1_PID 0xFA78
/* Tira-1 IR tranceiver */
/* USB-UIRT - An infrared receiver and transmitter using the 8U232AM chip */
/* http://home.earthlink.net/~jrhees/USBUIRT/index.htm */
#define FTDI_USB_UIRT_PID 0xF850
/* Product Id */
/* Commands */
#define FTDI_SIO_RESET 0
/* Reset the port */
#define FTDI_SIO_MODEM_CTRL 1
/* Set the modem control register */
#define FTDI_SIO_SET_FLOW_CTRL 2
/* Set flow control register */
...
...
@@ -84,19 +172,61 @@
/*
* BmRequestType: 0100 0000B
* bRequest: FTDI_SIO_SET_BAUDRATE
* wValue: Baud
Rate
value - see below
* wValue: Baud
Divisor
value - see below
* wIndex: Port
* wLength: 0
* Data: None
* The BaudDivisor values are calculated as follows:
* - BaseClock is either 12000000 or 48000000 depending on the device. FIXME: I wish
* I knew how to detect old chips to select proper base clock!
* - BaudDivisor is a fixed point number encoded in a funny way.
* (--WRONG WAY OF THINKING--)
* BaudDivisor is a fixed point number encoded with following bit weighs:
* (-2)(-1)(13..0). It is a radical with a denominator of 4, so values
* end with 0.0 (00...), 0.25 (10...), 0.5 (01...), and 0.75 (11...).
* (--THE REALITY--)
* The both-bits-set has quite different meaning from 0.75 - the chip designers
* have decided it to mean 0.125 instead of 0.75.
* This info looked up in FTDI application note "FT8U232 DEVICES \ Data Rates
* and Flow Control Consideration for USB to RS232".
* - BaudDivisor = (BaseClock / 16) / BaudRate, where the (=) operation should
* automagically re-encode the resulting value to take fractions into consideration.
* As all values are integers, some bit twiddling is in order:
* BaudDivisor = (BaseClock / 16 / BaudRate) |
* (((BaseClock / 2 / BaudRate) & 4) ? 0x4000 // 0.5
* : ((BaseClock / 2 / BaudRate) & 2) ? 0x8000 // 0.25
* : ((BaseClock / 2 / BaudRate) & 1) ? 0xc000 // 0.125
* : 0)
*
* For the FT232BM, a 17th divisor bit was introduced to encode the multiples
* of 0.125 missing from the FT8U232AM. Bits 16 to 14 are coded as follows
* (the first four codes are the same as for the FT8U232AM, where bit 16 is
* always 0):
* 000 - add .000 to divisor
* 001 - add .500 to divisor
* 010 - add .250 to divisor
* 011 - add .125 to divisor
* 100 - add .375 to divisor
* 101 - add .625 to divisor
* 110 - add .750 to divisor
* 111 - add .875 to divisor
* Bits 15 to 0 of the 17-bit divisor are placed in the urb value. Bit 16 is
* placed in bit 0 of the urb index.
*
* Note that there are a couple of special cases to support the highest baud
* rates. If the calculated divisor value is 1, this needs to be replaced with
* 0. Additionally for the FT232BM, if the calculated divisor value is 0x4001
* (1.5), this needs to be replaced with 0x0001 (1) (but this divisor value is
* not supported by the FT8U232AM).
*/
enum
ftdi_type
{
sio
=
1
,
F8U232AM
=
2
,
};
typedef
enum
{
SIO
=
1
,
FT8U232AM
=
2
,
FT232BM
=
3
,
}
ftdi_chip_type_t
;
enum
{
typedef
enum
{
ftdi_sio_b300
=
0
,
ftdi_sio_b600
=
1
,
ftdi_sio_b1200
=
2
,
...
...
@@ -107,39 +237,12 @@ enum {
ftdi_sio_b38400
=
7
,
ftdi_sio_b57600
=
8
,
ftdi_sio_b115200
=
9
};
enum
{
ftdi_8U232AM_12MHz_b300
=
0x09c4
,
ftdi_8U232AM_12MHz_b600
=
0x04E2
,
ftdi_8U232AM_12MHz_b1200
=
0x0271
,
ftdi_8U232AM_12MHz_b2400
=
0x4138
,
ftdi_8U232AM_12MHz_b4800
=
0x809c
,
ftdi_8U232AM_12MHz_b9600
=
0xc04e
,
ftdi_8U232AM_12MHz_b19200
=
0x0027
,
ftdi_8U232AM_12MHz_b38400
=
0x4013
,
ftdi_8U232AM_12MHz_b57600
=
0x000d
,
ftdi_8U232AM_12MHz_b115200
=
0x4006
,
ftdi_8U232AM_12MHz_b230400
=
0x8003
,
};
/* Apparently all devices are 48MHz */
enum
{
ftdi_8U232AM_48MHz_b300
=
0x2710
,
ftdi_8U232AM_48MHz_b600
=
0x1388
,
ftdi_8U232AM_48MHz_b1200
=
0x09c4
,
ftdi_8U232AM_48MHz_b2400
=
0x04e2
,
ftdi_8U232AM_48MHz_b4800
=
0x0271
,
ftdi_8U232AM_48MHz_b9600
=
0x4138
,
ftdi_8U232AM_48MHz_b19200
=
0x809c
,
ftdi_8U232AM_48MHz_b38400
=
0xc04e
,
ftdi_8U232AM_48MHz_b57600
=
0x0034
,
ftdi_8U232AM_48MHz_b115200
=
0x001a
,
ftdi_8U232AM_48MHz_b230400
=
0x000d
,
ftdi_8U232AM_48MHz_b460800
=
0x4006
,
ftdi_8U232AM_48MHz_b921600
=
0x8003
,
};
}
FTDI_SIO_baudrate_t
;
/*
* The ftdi_8U232AM_xxMHz_byyy constants have been removed. The encoded divisor values
* are calculated internally.
*/
#define FTDI_SIO_SET_DATA_REQUEST FTDI_SIO_SET_DATA
#define FTDI_SIO_SET_DATA_REQUEST_TYPE 0x40
...
...
@@ -443,6 +546,11 @@ enum {
* B7 Error in RCVR FIFO
*
*/
#define FTDI_RS0_CTS (1 << 4)
#define FTDI_RS0_DSR (1 << 5)
#define FTDI_RS0_RI (1 << 6)
#define FTDI_RS0_RLSD (1 << 7)
#define FTDI_RS_DR 1
#define FTDI_RS_OE (1<<1)
#define FTDI_RS_PE (1<<2)
...
...
drivers/usb/storage/datafab.c
View file @
293a4f60
...
...
@@ -94,7 +94,7 @@ static int datafab_read_data(struct us_data *us,
unsigned
char
*
dest
,
int
use_sg
)
{
unsigned
char
command
[
8
]
=
{
0
,
0
,
0
,
0
,
0
,
0xE0
,
0x20
,
0x01
}
;
unsigned
char
*
command
=
us
->
iobuf
;
unsigned
char
*
buffer
=
NULL
;
unsigned
char
*
ptr
;
unsigned
char
thistime
;
...
...
@@ -116,8 +116,6 @@ static int datafab_read_data(struct us_data *us,
return
rc
;
}
command
[
5
]
+=
(
info
->
lun
<<
4
);
totallen
=
sectors
*
info
->
ssize
;
do
{
...
...
@@ -138,10 +136,13 @@ static int datafab_read_data(struct us_data *us,
command
[
3
]
=
(
sector
>>
8
)
&
0xFF
;
command
[
4
]
=
(
sector
>>
16
)
&
0xFF
;
command
[
5
]
=
0xE0
+
(
info
->
lun
<<
4
);
command
[
5
]
|=
(
sector
>>
24
)
&
0x0F
;
command
[
6
]
=
0x20
;
command
[
7
]
=
0x01
;
// send the read command
result
=
datafab_bulk_write
(
us
,
command
,
sizeof
(
command
)
);
result
=
datafab_bulk_write
(
us
,
command
,
8
);
if
(
result
!=
USB_STOR_XFER_GOOD
)
goto
leave
;
...
...
@@ -180,8 +181,8 @@ static int datafab_write_data(struct us_data *us,
unsigned
char
*
src
,
int
use_sg
)
{
unsigned
char
command
[
8
]
=
{
0
,
0
,
0
,
0
,
0
,
0xE0
,
0x30
,
0x02
}
;
unsigned
char
reply
[
2
]
=
{
0
,
0
}
;
unsigned
char
*
command
=
us
->
iobuf
;
unsigned
char
*
reply
=
us
->
iobuf
;
unsigned
char
*
buffer
=
NULL
;
unsigned
char
*
ptr
;
unsigned
char
thistime
;
...
...
@@ -202,8 +203,6 @@ static int datafab_write_data(struct us_data *us,
return
rc
;
}
command
[
5
]
+=
(
info
->
lun
<<
4
);
// If we're using scatter-gather, we have to create a new
// buffer to read all of the data in first, since a
// scatter-gather buffer could in theory start in the middle
...
...
@@ -237,10 +236,13 @@ static int datafab_write_data(struct us_data *us,
command
[
3
]
=
(
sector
>>
8
)
&
0xFF
;
command
[
4
]
=
(
sector
>>
16
)
&
0xFF
;
command
[
5
]
=
0xE0
+
(
info
->
lun
<<
4
);
command
[
5
]
|=
(
sector
>>
24
)
&
0x0F
;
command
[
6
]
=
0x30
;
command
[
7
]
=
0x02
;
// send the command
result
=
datafab_bulk_write
(
us
,
command
,
sizeof
(
command
)
);
result
=
datafab_bulk_write
(
us
,
command
,
8
);
if
(
result
!=
USB_STOR_XFER_GOOD
)
goto
leave
;
...
...
@@ -250,7 +252,7 @@ static int datafab_write_data(struct us_data *us,
goto
leave
;
// read the result
result
=
datafab_bulk_read
(
us
,
reply
,
sizeof
(
reply
)
);
result
=
datafab_bulk_read
(
us
,
reply
,
2
);
if
(
result
!=
USB_STOR_XFER_GOOD
)
goto
leave
;
...
...
@@ -291,13 +293,19 @@ static int datafab_determine_lun(struct us_data *us,
//
// There might be a better way of doing this?
unsigned
char
command
[
8
]
=
{
0
,
1
,
0
,
0
,
0
,
0xa0
,
0xec
,
1
};
unsigned
char
buf
[
512
];
static
unsigned
char
scommand
[
8
]
=
{
0
,
1
,
0
,
0
,
0
,
0xa0
,
0xec
,
1
};
unsigned
char
*
command
=
us
->
iobuf
;
unsigned
char
*
buf
;
int
count
=
0
,
rc
;
if
(
!
us
||
!
info
)
return
USB_STOR_TRANSPORT_ERROR
;
memcpy
(
command
,
scommand
,
8
);
buf
=
kmalloc
(
512
,
GFP_NOIO
);
if
(
!
buf
)
return
USB_STOR_TRANSPORT_ERROR
;
US_DEBUGP
(
"datafab_determine_lun: locating...
\n
"
);
// we'll try 3 times before giving up...
...
...
@@ -306,31 +314,41 @@ static int datafab_determine_lun(struct us_data *us,
command
[
5
]
=
0xa0
;
rc
=
datafab_bulk_write
(
us
,
command
,
8
);
if
(
rc
!=
USB_STOR_XFER_GOOD
)
return
USB_STOR_TRANSPORT_ERROR
;
if
(
rc
!=
USB_STOR_XFER_GOOD
)
{
rc
=
USB_STOR_TRANSPORT_ERROR
;
goto
leave
;
}
rc
=
datafab_bulk_read
(
us
,
buf
,
sizeof
(
buf
)
);
rc
=
datafab_bulk_read
(
us
,
buf
,
512
);
if
(
rc
==
USB_STOR_XFER_GOOD
)
{
info
->
lun
=
0
;
return
USB_STOR_TRANSPORT_GOOD
;
rc
=
USB_STOR_TRANSPORT_GOOD
;
goto
leave
;
}
command
[
5
]
=
0xb0
;
rc
=
datafab_bulk_write
(
us
,
command
,
8
);
if
(
rc
!=
USB_STOR_XFER_GOOD
)
return
USB_STOR_TRANSPORT_ERROR
;
if
(
rc
!=
USB_STOR_XFER_GOOD
)
{
rc
=
USB_STOR_TRANSPORT_ERROR
;
goto
leave
;
}
rc
=
datafab_bulk_read
(
us
,
buf
,
sizeof
(
buf
)
);
rc
=
datafab_bulk_read
(
us
,
buf
,
512
);
if
(
rc
==
USB_STOR_XFER_GOOD
)
{
info
->
lun
=
1
;
return
USB_STOR_TRANSPORT_GOOD
;
rc
=
USB_STOR_TRANSPORT_GOOD
;
goto
leave
;
}
wait_ms
(
20
);
}
return
USB_STOR_TRANSPORT_ERROR
;
rc
=
USB_STOR_TRANSPORT_ERROR
;
leave:
kfree
(
buf
);
return
rc
;
}
static
int
datafab_id_device
(
struct
us_data
*
us
,
...
...
@@ -340,8 +358,9 @@ static int datafab_id_device(struct us_data *us,
// to the ATA spec, 'Sector Count' isn't used but the Windows driver
// sets this bit so we do too...
//
unsigned
char
command
[
8
]
=
{
0
,
1
,
0
,
0
,
0
,
0xa0
,
0xec
,
1
};
unsigned
char
reply
[
512
];
static
unsigned
char
scommand
[
8
]
=
{
0
,
1
,
0
,
0
,
0
,
0xa0
,
0xec
,
1
};
unsigned
char
*
command
=
us
->
iobuf
;
unsigned
char
*
reply
;
int
rc
;
if
(
!
us
||
!
info
)
...
...
@@ -353,11 +372,18 @@ static int datafab_id_device(struct us_data *us,
return
rc
;
}
memcpy
(
command
,
scommand
,
8
);
reply
=
kmalloc
(
512
,
GFP_NOIO
);
if
(
!
reply
)
return
USB_STOR_TRANSPORT_ERROR
;
command
[
5
]
+=
(
info
->
lun
<<
4
);
rc
=
datafab_bulk_write
(
us
,
command
,
8
);
if
(
rc
!=
USB_STOR_XFER_GOOD
)
return
USB_STOR_TRANSPORT_ERROR
;
if
(
rc
!=
USB_STOR_XFER_GOOD
)
{
rc
=
USB_STOR_TRANSPORT_ERROR
;
goto
leave
;
}
// we'll go ahead and extract the media capacity while we're here...
//
...
...
@@ -369,10 +395,15 @@ static int datafab_id_device(struct us_data *us,
((
u32
)(
reply
[
116
])
<<
16
)
|
((
u32
)(
reply
[
115
])
<<
8
)
|
((
u32
)(
reply
[
114
])
);
return
USB_STOR_TRANSPORT_GOOD
;
rc
=
USB_STOR_TRANSPORT_GOOD
;
goto
leave
;
}
return
USB_STOR_TRANSPORT_ERROR
;
rc
=
USB_STOR_TRANSPORT_ERROR
;
leave:
kfree
(
reply
);
return
rc
;
}
...
...
@@ -571,8 +602,7 @@ int datafab_transport(Scsi_Cmnd * srb, struct us_data *us)
return
USB_STOR_TRANSPORT_ERROR
;
}
// don't bother implementing READ_6 or WRITE_6. Just set MODE_XLATE and
// let the usb storage code convert to READ_10/WRITE_10
// don't bother implementing READ_6 or WRITE_6.
//
if
(
srb
->
cmnd
[
0
]
==
READ_10
)
{
block
=
((
u32
)(
srb
->
cmnd
[
2
])
<<
24
)
|
((
u32
)(
srb
->
cmnd
[
3
])
<<
16
)
|
...
...
drivers/usb/storage/freecom.c
View file @
293a4f60
...
...
@@ -44,11 +44,6 @@ static void pdump (void *, int);
#define ERR_STAT 0x01
#define DRQ_STAT 0x08
struct
freecom_udata
{
u8
buffer
[
64
];
/* Common command block. */
};
typedef
struct
freecom_udata
*
freecom_udata_t
;
/* All of the outgoing packets are 64 bytes long. */
struct
freecom_cb_wrap
{
u8
Type
;
/* Command type. */
...
...
@@ -112,9 +107,8 @@ static int
freecom_readdata
(
Scsi_Cmnd
*
srb
,
struct
us_data
*
us
,
unsigned
int
ipipe
,
unsigned
int
opipe
,
int
count
)
{
freecom_udata_t
extra
=
(
freecom_udata_t
)
us
->
extra
;
struct
freecom_xfer_wrap
*
fxfr
=
(
struct
freecom_xfer_wrap
*
)
extra
->
buffer
;
(
struct
freecom_xfer_wrap
*
)
us
->
iobuf
;
int
result
;
fxfr
->
Type
=
FCM_PACKET_INPUT
|
0x00
;
...
...
@@ -147,9 +141,8 @@ static int
freecom_writedata
(
Scsi_Cmnd
*
srb
,
struct
us_data
*
us
,
int
unsigned
ipipe
,
unsigned
int
opipe
,
int
count
)
{
freecom_udata_t
extra
=
(
freecom_udata_t
)
us
->
extra
;
struct
freecom_xfer_wrap
*
fxfr
=
(
struct
freecom_xfer_wrap
*
)
extra
->
buffer
;
(
struct
freecom_xfer_wrap
*
)
us
->
iobuf
;
int
result
;
fxfr
->
Type
=
FCM_PACKET_OUTPUT
|
0x00
;
...
...
@@ -190,12 +183,9 @@ int freecom_transport(Scsi_Cmnd *srb, struct us_data *us)
int
result
;
unsigned
int
partial
;
int
length
;
freecom_udata_t
extra
;
extra
=
(
freecom_udata_t
)
us
->
extra
;
fcb
=
(
struct
freecom_cb_wrap
*
)
extra
->
buffer
;
fst
=
(
struct
freecom_status
*
)
extra
->
buffer
;
fcb
=
(
struct
freecom_cb_wrap
*
)
us
->
iobuf
;
fst
=
(
struct
freecom_status
*
)
us
->
iobuf
;
US_DEBUGP
(
"Freecom TRANSPORT STARTED
\n
"
);
...
...
@@ -386,18 +376,11 @@ int
freecom_init
(
struct
us_data
*
us
)
{
int
result
;
char
buffer
[
33
];
/* Allocate a buffer for us. The upper usb transport code will
* free this for us when cleaning up. */
if
(
us
->
extra
==
NULL
)
{
us
->
extra
=
kmalloc
(
sizeof
(
struct
freecom_udata
),
GFP_KERNEL
);
if
(
us
->
extra
==
NULL
)
{
US_DEBUGP
(
"Out of memory
\n
"
);
return
USB_STOR_TRANSPORT_ERROR
;
}
}
char
*
buffer
=
us
->
iobuf
;
/* The DMA-mapped I/O buffer is 64 bytes long, just right for
* all our packets. No need to allocate any extra buffer space.
*/
result
=
usb_stor_control_msg
(
us
,
us
->
recv_ctrl_pipe
,
0x4c
,
0xc0
,
0x4346
,
0x0
,
buffer
,
0x20
,
3
*
HZ
);
...
...
drivers/usb/storage/initializers.c
View file @
293a4f60
...
...
@@ -47,38 +47,27 @@
* mode */
int
usb_stor_euscsi_init
(
struct
us_data
*
us
)
{
unsigned
char
data
=
0x1
;
int
result
;
US_DEBUGP
(
"Attempting to init eUSCSI bridge...
\n
"
);
us
->
iobuf
[
0
]
=
0x1
;
result
=
usb_stor_control_msg
(
us
,
us
->
send_ctrl_pipe
,
0x0C
,
USB_RECIP_INTERFACE
|
USB_TYPE_VENDOR
,
0x01
,
0x0
,
&
data
,
0x1
,
5
*
HZ
);
0x01
,
0x0
,
us
->
iobuf
,
0x1
,
5
*
HZ
);
US_DEBUGP
(
"-- result is %d
\n
"
,
result
);
US_DEBUGP
(
"-- data afterwards is %d
\n
"
,
data
);
US_DEBUGP
(
"-- data afterwards is %d
\n
"
,
us
->
iobuf
[
0
]
);
return
0
;
}
/* This function is required to activate all four slots on the UCR-61S2B
* flash reader */
int
usb_stor_ucr61s2b_init
(
struct
us_data
*
us
)
{
struct
bulk_cb_wrap
*
bcb
;
struct
bulk_cs_wrap
*
bcs
;
struct
bulk_cb_wrap
*
bcb
=
(
struct
bulk_cb_wrap
*
)
us
->
iobuf
;
struct
bulk_cs_wrap
*
bcs
=
(
struct
bulk_cs_wrap
*
)
us
->
iobuf
;
int
res
,
partial
;
bcb
=
kmalloc
(
sizeof
*
bcb
,
in_interrupt
()
?
GFP_ATOMIC
:
GFP_NOIO
);
if
(
!
bcb
)
{
return
(
-
1
);
}
bcs
=
kmalloc
(
sizeof
*
bcs
,
in_interrupt
()
?
GFP_ATOMIC
:
GFP_NOIO
);
if
(
!
bcs
)
{
kfree
(
bcb
);
return
(
-
1
);
}
US_DEBUGP
(
"Sending UCR-61S2B initialization packet...
\n
"
);
bcb
->
Signature
=
cpu_to_le32
(
US_BULK_CB_SIGN
);
...
...
@@ -91,19 +80,12 @@ int usb_stor_ucr61s2b_init(struct us_data *us)
res
=
usb_stor_bulk_transfer_buf
(
us
,
us
->
send_bulk_pipe
,
bcb
,
US_BULK_CB_WRAP_LEN
,
&
partial
);
US_DEBUGP
(
"-- result is %d
\n
"
,
res
);
kfree
(
bcb
);
if
(
res
)
{
kfree
(
bcs
);
return
(
res
);
}
if
(
res
)
return
res
;
US_DEBUGP
(
"Getting status packet...
\n
"
);
res
=
usb_stor_bulk_transfer_buf
(
us
,
us
->
recv_bulk_pipe
,
bcs
,
US_BULK_CS_WRAP_LEN
,
&
partial
);
US_DEBUGP
(
"-- result of status read is %d
\n
"
,
res
);
kfree
(
bcs
);
return
(
res
?
-
1
:
0
);
return
(
res
?
-
1
:
0
);
}
drivers/usb/storage/unusual_devs.h
View file @
293a4f60
...
...
@@ -90,12 +90,6 @@ UNUSUAL_DEV( 0x0436, 0x0005, 0x0100, 0x0100,
US_SC_SCSI
,
US_PR_DPCM_USB
,
NULL
,
0
),
#endif
/* Made with the help of Edd Dumbill <edd@usefulinc.com> */
UNUSUAL_DEV
(
0x0451
,
0x5409
,
0x0001
,
0x0001
,
"Frontier Labs"
,
"Nex II Digital"
,
US_SC_SCSI
,
US_PR_BULK
,
NULL
,
0
),
/* Patch submitted by Philipp Friedrich <philipp@void.at> */
UNUSUAL_DEV
(
0x0482
,
0x0100
,
0x0100
,
0x0100
,
"Kyocera"
,
...
...
@@ -276,7 +270,7 @@ UNUSUAL_DEV( 0x054c, 0x002e, 0x0106, 0x0310,
UNUSUAL_DEV
(
0x054c
,
0x0032
,
0x0000
,
0x9999
,
"Sony"
,
"Memorystick MSC-U01N"
,
US_SC_
UFI
,
US_PR_CB
,
NULL
,
US_SC_
DEVICE
,
US_PR_DEVICE
,
NULL
,
US_FL_SINGLE_LUN
),
UNUSUAL_DEV
(
0x054c
,
0x0069
,
0x0000
,
0x9999
,
...
...
@@ -301,7 +295,7 @@ UNUSUAL_DEV( 0x057b, 0x0000, 0x0000, 0x0299,
UNUSUAL_DEV
(
0x057b
,
0x0000
,
0x0300
,
0x9999
,
"Y-E Data"
,
"Flashbuster-U"
,
US_SC_
UFI
,
US_PR_CBI
,
NULL
,
US_SC_
DEVICE
,
US_PR_DEVICE
,
NULL
,
US_FL_SINGLE_LUN
),
UNUSUAL_DEV
(
0x059f
,
0xa601
,
0x0200
,
0x0200
,
...
...
drivers/usb/usb-skeleton.c
View file @
293a4f60
...
...
@@ -646,9 +646,6 @@ static void skel_disconnect(struct usb_interface *interface)
dev
=
usb_get_intfdata
(
interface
);
usb_set_intfdata
(
interface
,
NULL
);
if
(
!
dev
)
return
;
down
(
&
dev
->
sem
);
/* disable open() */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment