--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Hello all.
I am trying to get the Hagiwara FlashGate (Compact Flash Reader/Writer)
working at Linux kernel 2.3.99-pre7-8.
First, I create an unusual_dev_list entry for this device as follows.
--- usb-storage.c ---
{ 0x0693, 0x0003, 0x0100,
"HagiwaraSysCom FlashGate CF", US_SC_SCSI, US_PR_BULK,
US_FL_SINGLE_LUN | US_FL_ALT_LENGTH }
Messages of dmesg are attached at the end of this mail. Time-out errors
are occurred when the disk capacity reading, and the device did not work.
I investigated the log and watched the state of device (Green READY Lamp),
and I suppose that it have two problems.
(1) After insmod usb-storage, around 2[sec] wait is necessary for the
device READY.
(2) If we send commands continuously when the device is NOT_READY, then
the device will be locked on the hardware.
I took measures to avoid this two problems as follows.
The case of Vendor ID = 0x0693 (Hagiwara Sys-Com):
(1) Insert 3 [sec] wait in the storage_probe().
(2) Check Device READY in the invoke_transport(), if the device is NOT_READY
then command will be canceled.
As a result, it works well.
This is a patch for usb-storage.c 2.3.99-pre7-8.
--- linux-2.3.99-pre7-8-org/drivers/usb/usb-storage.c Thu May 11 15:50:43 2000
+++ linux-2.3.99-pre7-8/drivers/usb/usb-storage.c Thu May 18 11:28:19 2000
@@ -283,6 +283,62 @@
* Transport routines
***********************************************************************/
+static int test_unit_ready(struct us_data *us)
+{
+ Scsi_Cmnd *srb;
+ int result, ret;
+ unsigned char old_cmnd[6];
+ int old_sg;
+ int old_request_bufflen;
+ void *old_request_buffer;
+
+ srb = us->srb;
+ memcpy(old_cmnd, srb->cmnd, 6);
+
+ srb->cmnd[0] = TEST_UNIT_READY;
+ srb->cmnd[1] = 0;
+ srb->cmnd[2] = 0;
+ srb->cmnd[3] = 0;
+ srb->cmnd[4] = 0;
+ srb->cmnd[5] = 0;
+ result = us->transport(srb, us);
+
+ ret = 0;
+ if(result == USB_STOR_TRANSPORT_FAILED) {
+ srb->cmnd[0] = REQUEST_SENSE;
+ srb->cmnd[1] = 0;
+ srb->cmnd[2] = 0;
+ srb->cmnd[3] = 0;
+ srb->cmnd[4] = 18;
+ srb->cmnd[5] = 0;
+ old_request_buffer = srb->request_buffer;
+ old_request_bufflen = srb->request_bufflen;
+ old_sg = srb->use_sg;
+ srb->request_buffer = srb->sense_buffer;
+ srb->request_bufflen = 18;
+ srb->use_sg = 0;
+ result = us->transport(srb, us);
+
+ if((srb->sense_buffer[2] & 0xf) == NOT_READY) {
+ ret = 1;
+ }
+ if(result != USB_STOR_TRANSPORT_GOOD) {
+ ret = -1;
+ }
+
+ srb->request_buffer = old_request_buffer;
+ srb->request_bufflen = old_request_bufflen;
+ srb->use_sg = old_sg;
+
+ } else if(result == USB_STOR_TRANSPORT_ERROR) {
+ ret = -1;
+ }
+
+ memcpy(srb->cmnd, old_cmnd, 6);
+ return ret;
+}
+
+
/* Invoke the transport and basic error-handling/recovery methods
*
* This is used by the protocol layers to actually send the message to
@@ -293,6 +349,21 @@
int need_auto_sense;
int result;
+ /* for Hagiwara Sys-Com FlashGate CF */
+ if(us->pusb_dev->descriptor.idVendor == 0x0693 &&
+ srb->cmnd[0] != TEST_UNIT_READY && srb->cmnd[0] != INQUIRY) {
+ int ret;
+
+ ret = test_unit_ready(us);
+ if(ret) {
+ srb->result = CHECK_CONDITION;
+ US_DEBUGP("<<< NOT READY: Command [%02xh] was canceled >>>\n",
+srb->cmnd[0]);
+ return;
+ } else {
+ US_DEBUGP("((( Drive is READY )))\n");
+ }
+ }
+
/* send the command to the transport layer */
result = us->transport(srb, us);
@@ -1448,6 +1519,9 @@
"Shuttle eUSB MMC Adapter", US_SC_SCSI, US_PR_CB, US_FL_SINGLE_LUN},
{ 0x03f0, 0x0107, 0x0200,
"HP USB CD-Writer Plus", US_SC_8070, US_PR_CB, 0},
+ { 0x0693, 0x0003, 0x0100,
+ "HagiwaraSysCom FlashGate CF", US_SC_SCSI, US_PR_BULK,
+ US_FL_SINGLE_LUN | US_FL_ALT_LENGTH },
{ 0x0000, 0x0000, 0x0,
"", 0, 0, 0}
};
@@ -1669,6 +1743,14 @@
/* lock access to the data structures */
down(&us_list_semaphore);
+
+ /* if ventor == HAGIWARA SYS-COM then */
+ if(dev->descriptor.idVendor == 0x0693) {
+ int timeout = HZ*3;
+ while(timeout) {
+ timeout = schedule_timeout(timeout);
+ }
+ }
/*
* Now check if we have seen this GUID before
----------------------------
Naohiko Toyokura
[EMAIL PROTECTED]
usb.c: registered new driver usb-storage
usb-storage.c: Searching unusual device list for (0x693, 0x3, 0x100)...
usb-storage.c: -- found matching device: HagiwaraSysCom FlashGate CF
usb-storage.c: USB Mass Storage device detected
usb-storage.c: Endpoints: In: 0xc58a9b60 Out: 0xc58a9b71 Int: 0x00000000 (Period 0)
usb-storage.c: Result from usb_set_interface is 0
usb-storage.c: New GUID 069300030000c00000002309
usb-storage.c: Transport: Bulk
usb-storage.c: Protocol: Transparent SCSI
usb-storage.c: *** thread sleeping.
scsi0 : SCSI emulation for USB Mass Storage devices
scsi : 1 host.
usb-storage.c: us_queuecommand() called
usb-storage.c: *** thread awakened.
usb-storage.c: Command TEST_UNIT_READY (6 bytes)
usb-storage.c: 00 00 00 00 00 00 12 c0 20 5a
usb-storage.c: Bulk command S 0x43425355 T 0x238 LUN 0 L 0 F 0 CL 6
usb-storage.c: Bulk command transfer result=0
usb-storage.c: Attempting to get CSW...
usb-storage.c: Bulk status result = 0
usb-storage.c: Bulk status S 0x53425355 T 0x238 R 0 V 0x1
usb-storage.c: -- transport indicates command failure
usb-storage.c: Issuing auto-REQUEST_SENSE
usb-storage.c: Bulk command S 0x43425355 T 0x238 LUN 0 L 18 F 128 CL 6
usb-storage.c: Bulk command transfer result=0
usb-storage.c: Bulk xfer 0xc4830900(18)
usb-storage.c: bulk_msg returned 0 xferred 18/18
usb-storage.c: Bulk data transfer result 0x0
usb-storage.c: Attempting to get CSW...
usb-storage.c: Bulk status result = 0
usb-storage.c: Bulk status S 0x53425355 T 0x238 R 0 V 0x0
usb-storage.c: -- Result from auto-sense is 0
usb-storage.c: -- code: 0x70, key: 0x6, ASC: 0x29, ASCQ: 0x0
usb-storage.c: scsi cmd done, result=0x1
usb-storage.c: *** thread sleeping.
usb-storage.c: us_queuecommand() called
usb-storage.c: *** thread awakened.
usb-storage.c: Command INQUIRY (6 bytes)
usb-storage.c: 12 00 00 00 ff 00 12 c0 20 5a
usb-storage.c: Bulk command S 0x43425355 T 0x239 LUN 0 L 36 F 128 CL 6
usb-storage.c: Bulk command transfer result=0
usb-storage.c: Bulk xfer 0xc31cbc70(256)
usb-storage.c: bulk_msg returned 0 xferred 36/256
usb-storage.c: Bulk data transfer result 0x1
usb-storage.c: Attempting to get CSW...
usb-storage.c: Bulk status result = 0
usb-storage.c: Bulk status S 0x53425355 T 0x239 R 0 V 0x0
usb-storage.c: Fixing INQUIRY data, setting SCSI rev to 2
usb-storage.c: scsi cmd done, result=0x0
usb-storage.c: *** thread sleeping.
Vendor: HAGIWARA Model: CompactFlash R/W Rev: 1.00
Type: Direct-Access ANSI SCSI revision: 02
Detected scsi removable disk sda at scsi0, channel 0, id 0, lun 0
usb-storage.c: us_queuecommand() called
usb-storage.c: *** thread awakened.
usb-storage.c: Bad device number (0/1)
usb-storage.c: *** thread sleeping.
usb-storage.c: us_queuecommand() called
usb-storage.c: *** thread awakened.
usb-storage.c: Bad device number (1/0)
usb-storage.c: *** thread sleeping.
usb-storage.c: us_queuecommand() called
usb-storage.c: *** thread awakened.
usb-storage.c: Bad device number (2/0)
usb-storage.c: *** thread sleeping.
usb-storage.c: us_queuecommand() called
usb-storage.c: *** thread awakened.
usb-storage.c: Bad device number (3/0)
usb-storage.c: *** thread sleeping.
usb-storage.c: us_queuecommand() called
usb-storage.c: *** thread awakened.
usb-storage.c: Bad device number (4/0)
usb-storage.c: *** thread sleeping.
usb-storage.c: us_queuecommand() called
usb-storage.c: *** thread awakened.
usb-storage.c: Bad device number (5/0)
usb-storage.c: *** thread sleeping.
usb-storage.c: us_queuecommand() called
usb-storage.c: *** thread awakened.
usb-storage.c: Bad device number (6/0)
usb-storage.c: *** thread sleeping.
usb-storage.c: us_queuecommand() called
usb-storage.c: *** thread awakened.
usb-storage.c: Bad device number (7/0)
usb-storage.c: *** thread sleeping.
usb-storage.c: us_queuecommand() called
usb-storage.c: *** thread awakened.
usb-storage.c: Command TEST_UNIT_READY (6 bytes)
usb-storage.c: 00 00 00 00 00 00 00 00 00 00
usb-storage.c: Bulk command S 0x43425355 T 0x242 LUN 0 L 0 F 0 CL 6
usb-storage.c: Bulk command transfer result=0
usb-storage.c: Attempting to get CSW...
usb-storage.c: Bulk status result = 0
usb-storage.c: Bulk status S 0x53425355 T 0x242 R 0 V 0x1
usb-storage.c: -- transport indicates command failure
usb-storage.c: Issuing auto-REQUEST_SENSE
usb-storage.c: Bulk command S 0x43425355 T 0x242 LUN 0 L 18 F 128 CL 6
usb-storage.c: Bulk command transfer result=0
usb-storage.c: Bulk xfer 0xc3edff00(18)
usb-storage.c: bulk_msg returned 0 xferred 18/18
usb-storage.c: Bulk data transfer result 0x0
usb-storage.c: Attempting to get CSW...
usb-storage.c: Bulk status result = 0
usb-storage.c: Bulk status S 0x53425355 T 0x242 R 0 V 0x0
usb-storage.c: -- Result from auto-sense is 0
usb-storage.c: -- code: 0x70, key: 0x2, ASC: 0x4, ASCQ: 0x1
usb-storage.c: scsi cmd done, result=0x1
usb-storage.c: *** thread sleeping.
usb-storage.c: us_queuecommand() called
usb-storage.c: *** thread awakened.
usb-storage.c: Command READ_CAPACITY (10 bytes)
usb-storage.c: 25 00 00 00 00 00 00 00 00 00
usb-storage.c: Bulk command S 0x43425355 T 0x243 LUN 0 L 8 F 128 CL 10
usb-storage.c: Bulk command transfer result=0
usb-storage.c: Bulk xfer 0xc02f6000(8)
usb-uhci.c: interrupt, status 3, frame# 437
usb-storage.c: bulk_msg returned -32 xferred 0/8
usb-storage.c: clearing endpoint halt for pipe 0xc0008380
usb_control/bulk_msg: timeout
usb-storage.c: Bulk data transfer result 0x2
usb-storage.c: Attempting to get CSW...
usb-storage.c: clearing endpoint halt for pipe 0xc0008380
usb-uhci.c: interrupt, status 2, frame# 1396
usb-uhci-debug.h: TD @ c34f57a0/034F57A0, MaxLen=07 DT0 EP=0 Dev=3 PID=(SETUP)
buf=04f399c0
usb-uhci-debug.h: Len=07 e0 SPD Stalled CRC/Timeo
usb-uhci-debug.h: Link points to TD @ 034f5820, Breadth first
usb-storage.c: Attempting to get CSW (2nd try)...
usb-storage.c: clearing halt for pipe 0xc0008380
usb-uhci.c: interrupt, status 2, frame# 1398
usb-uhci-debug.h: TD @ c34f5a60/034F5A60, MaxLen=07 DT0 EP=0 Dev=3 PID=(SETUP)
buf=04f399c0
usb-uhci-debug.h: Len=07 e0 SPD Stalled CRC/Timeo
usb-uhci-debug.h: Link points to TD @ 034f5920, Breadth first
usb-storage.c: -- transport indicates transport failure
usb-storage.c: scsi cmd done, result=0x70000
usb-storage.c: *** thread sleeping.
usb-storage.c: us_queuecommand() called
usb-storage.c: *** thread awakened.
usb-storage.c: Command READ_CAPACITY (10 bytes)
usb-storage.c: 25 00 00 00 00 00 00 00 00 00
usb-storage.c: Bulk command S 0x43425355 T 0x244 LUN 0 L 8 F 128 CL 10
usb_control/bulk_msg: timeout
usb-storage.c: Bulk command transfer result=-110
usb-storage.c: Attempting to get CSW...
usb-storage.c: clearing endpoint halt for pipe 0xc0008380
usb-uhci.c: interrupt, status 2, frame# 263
usb-uhci-debug.h: TD @ c34f58e0/034F58E0, MaxLen=07 DT0 EP=0 Dev=3 PID=(SETUP)
buf=04f399c0
usb-uhci-debug.h: Len=07 e0 SPD Stalled CRC/Timeo
usb-uhci-debug.h: Link points to TD @ 034f5a20, Breadth first
usb-storage.c: Attempting to get CSW (2nd try)...
usb-storage.c: clearing halt for pipe 0xc0008380
usb-uhci.c: interrupt, status 2, frame# 265
usb-uhci-debug.h: TD @ c34f5920/034F5920, MaxLen=07 DT0 EP=0 Dev=3 PID=(SETUP)
buf=04f399c0
usb-uhci-debug.h: Len=07 e0 SPD Stalled CRC/Timeo
usb-uhci-debug.h: Link points to TD @ 034f5a60, Breadth first
usb-storage.c: -- transport indicates transport failure
usb-storage.c: scsi cmd done, result=0x70000
usb-storage.c: *** thread sleeping.
usb-storage.c: us_queuecommand() called
usb-storage.c: *** thread awakened.
usb-storage.c: Command READ_CAPACITY (10 bytes)
usb-storage.c: 25 00 00 00 00 00 00 00 00 00
usb-storage.c: Bulk command S 0x43425355 T 0x245 LUN 0 L 8 F 128 CL 10
usb_control/bulk_msg: timeout
<The rest is omitted ...>
- Re: [linux-usb] Hagiwara FlashGate (CF) Naohiko Toyokura
- Re: [linux-usb] Hagiwara FlashGate (CF) Vojtech Pavlik
- Re: [linux-usb] Hagiwara FlashGate (CF) Matthew Dharm
- Re: [linux-usb] Hagiwara FlashGate (CF) Vojtech Pavlik
- Re: [linux-usb] Hagiwara FlashGate (CF) Naohiko Toyokura
- RE: [linux-usb] Hagiwara FlashGate (CF) Dunlap, Randy
