Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[HOWTO] Fix SCSI Errors with GeneSys Logic USB-2-IDE
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Master_Of_Disaster
l33t
l33t


Joined: 28 Feb 2003
Posts: 610
Location: 15.05072° East, 48.13747° North (aka Mauer), Austria

PostPosted: Mon Mar 22, 2004 12:34 am    Post subject: [HOWTO] Fix SCSI Errors with GeneSys Logic USB-2-IDE Reply with quote

Last Change: 2. 5. 2004

I recently bought such a device and it refused to work first. After writing a few MB to it, it hang with the 'busy' led on. Only pulling the plug helped. After that, the messages below apperead in the syslog. I poked around in the net and found out at lkml.org that this is caused by timing problems with I/O. So I wrote a little kernel patch against 2.6 which takes care of this.

lsusb
Code:
Bus 003 Device 006: ID 05e3:0702 Genesys Logic, Inc.


dmesg
Code:
Mar 21 17:36:31 hephaestos scsi: Device offlined - not ready after error recovery: host 0 channel 0 id 0 lun 0
Mar 21 17:36:31 hephaestos SCSI error : <0 0 0 0> return code = 0x50000
Mar 21 17:36:31 hephaestos SCSI error : <0 0 0 0> return code = 0x70000
Mar 21 17:36:31 hephaestos scsi0 (0:0): rejecting I/O to offline device


WARNING
This patch should be used with care and at least with 2.6.4.
I get problems with kernels newer than 2.6.4, something is fucked up here. This patch will not change anything with kernels >=2.6.5 && <=2.6.6-rc3-mm1. Stay tuned, if I can dig up something you'll find it here.
/WARNING

Code:
diff -Naur linux-2.6.4/drivers/usb/storage/Kconfig linux-2.6.4-gentoo-r1/drivers/usb/storage/Kconfig
--- linux-2.6.4/drivers/usb/storage/Kconfig     2004-03-11 03:55:45.000000000 +0100
+++ linux-2.6.4-gentoo-r1/drivers/usb/storage/Kconfig   2004-03-22 01:09:42.676023496 +0100
@@ -91,3 +91,10 @@
          Say Y here to include additional code to support the Lexar Jumpshot
          USB CompactFlash reader.

+config USB_STORAGE_GENESYS_FIX
+       bool "Genesys Logic USB2.0-to-IDE fix (EXPERIMENTAL)"
+       depends on USB_STORAGE && EXPERIMENTAL
+       help
+         Say Y here get around a nasty bug with Genesys Logic devices.
+         If you get SCSI errors when writing to such a device, you should enable this.
+         This sets max_sectors to 128.
diff -Naur linux-2.6.4/drivers/usb/storage/scsiglue.c linux-2.6.4-gentoo-r1/drivers/usb/storage/scsiglue.c
--- linux-2.6.4/drivers/usb/storage/scsiglue.c  2004-03-11 03:55:27.000000000 +0100
+++ linux-2.6.4-gentoo-r1/drivers/usb/storage/scsiglue.c        2004-03-22 01:11:06.348303376 +0100
@@ -371,8 +371,11 @@
        .sg_tablesize =                 SG_ALL,

        /* limit the total size of a transfer to 120 KB */
-       .max_sectors =                  240,
-
+#ifdef CONFIG_USB_STORAGE_GENESYS_FIX
+       .max_sectors =                  128,
+#else
+       .max_sectors =                  240,
+#endif
        /* merge commands... this seems to help performance, but
         * periodically someone should test to see which setting is more
         * optimal.

Save this as patch-scsi-glue and apply it to your kernel with:
Code:
cd /usr/src/linux
cat /path/to/patch-scsi-glue | patch -p1

You should have a new option in Device Drivers -> USB Support, reading "Genesys Logic USB2.0-to-IDE fix". If you check it, the fix will be activated.
Now follow the instructions for kernel compilation, and you will be fine.

I am using 2.6.4-gentoo-r1 and udev-021-r1 and all works fine now. Speed is about 20 to 23 MB/sec.
_________________
post tenebras lux, post fenestras tux
Registered Linux User Nr. 312509
Adopt an unanswered post today!


Last edited by Master_Of_Disaster on Sun May 02, 2004 10:36 pm; edited 2 times in total
Back to top
View user's profile Send private message
thepi
Guru
Guru


Joined: 06 Jan 2004
Posts: 352
Location: Tokyo, Japan

PostPosted: Sat May 01, 2004 10:11 pm    Post subject: Reply with quote

damnit, i found this one way too late!

had the same problem after buying an external hdd, about 2 months ago. i figured that it was a timing problem, but digging through these forums brought out nothing, and i'm just not enough of a kernel coder to fix it on my own (wouldn't have known where to start). :(

o'course i brought the thing back since a device not working under linux is like not working at all for me :) anywho, great work, MoD. at least i can now wait for another store to have a special pricing on external hdd's, now that i know it'd work.

keep it up!
pi~

p.s.: the gentoo-wiki is kind of a good idea... maybe it should be combined w/ these forums, like if there's something good enough to be a howto, it should be posted there. i think many (esp. new) users would love to have that, as it's sometimes hard to find the appropriate posting here. good searching is science :wink:
_________________
Violence is the last resort of the incompetent --Isaac Asimov
Gentoo on Acer TM800 | Help! | Vote! | Get FF!
Back to top
View user's profile Send private message
CB2206
Tux's lil' helper
Tux's lil' helper


Joined: 27 May 2003
Posts: 127
Location: NRW

PostPosted: Fri Jun 18, 2004 5:59 am    Post subject: Reply with quote

hi,

i tried your patch against vanilla 2.6.7 but i still get the error. do you have any further information?

thx for any help!
_________________
CB
Back to top
View user's profile Send private message
toweruser
n00b
n00b


Joined: 18 Jun 2004
Posts: 6

PostPosted: Fri Jun 18, 2004 11:09 am    Post subject: Reply with quote

CB2206 wrote:


i tried your patch against vanilla 2.6.7 but i still get the error. do you have any further information?


Hi,

same problem here: On USB 1.1 (ohci) the HD works fine, on USB 2.0 (ehci) the HD hangs, even if you modify the

.max_sectors = 240

to

.max_sectors = 128,

by hand.

I read somewhere on a mailing list, the problem with the "ID 05e3:0702 Genesys Logic, Inc." is more general. It seems the device is not 100% compliant to the USB 2.0 standard.

Regards

Toweruser.
_________________
The price of freedom is responsibility, but it's a bargain, because freedom is priceless. - Hugh Downs.
Learn to live freely, learn GNU/Linux!
Back to top
View user's profile Send private message
CB2206
Tux's lil' helper
Tux's lil' helper


Joined: 27 May 2003
Posts: 127
Location: NRW

PostPosted: Fri Jun 18, 2004 12:47 pm    Post subject: Reply with quote

where did you read this?
_________________
CB
Back to top
View user's profile Send private message
toweruser
n00b
n00b


Joined: 18 Jun 2004
Posts: 6

PostPosted: Fri Jun 18, 2004 2:54 pm    Post subject: Reply with quote

CB2206 wrote:
where did you read this?


here:

http://www.mail-archive.com/linux-usb-devel@lists.sourceforge.net/msg23196.html

Ist not the same posting i mentioned above, but deals with the same issue.

On the mailing list linux-usb-devel are many topics
about genesys IDE to USB problems but no (easy appliable) solution
at all.

TU
_________________
The price of freedom is responsibility, but it's a bargain, because freedom is priceless. - Hugh Downs.
Learn to live freely, learn GNU/Linux!
Back to top
View user's profile Send private message
CB2206
Tux's lil' helper
Tux's lil' helper


Joined: 27 May 2003
Posts: 127
Location: NRW

PostPosted: Fri Jun 18, 2004 4:12 pm    Post subject: Reply with quote

well, i need to copy about 70-80gb from this drive and using usb1.1 will last hours. (ok, searching for a solution as well ;-))
_________________
CB
Back to top
View user's profile Send private message
jackie
Tux's lil' helper
Tux's lil' helper


Joined: 12 May 2004
Posts: 113

PostPosted: Tue Jun 29, 2004 4:27 pm    Post subject: Reply with quote

I found this patch in http://www.mail-archive.com/linux-usb-devel%40lists.sourceforge.net/msg25304.html

===== drivers/usb/storage/usb.c 1.119 vs edited =====
--- 1.119/drivers/usb/storage/usb.c Sun Jun 13 16:09:07 2004
+++ edited/drivers/usb/storage/usb.c Fri Jun 18 11:48:08 2004
@@ -358,6 +358,18 @@

/* we've got a command, let's do it! */
else {
+ int frame1, frame2, count;
+
+ frame1 = usb_get_current_frame_number(us->pusb_dev);
+ count = 0;
+ do {
+ yield();
+ frame2 = usb_get_current_frame_number(us->pusb_dev);
+ if (frame1 != frame2) {
+ frame1 = frame2;
+ ++count;
+ }
+ } while (count < 2);
US_DEBUG(usb_stor_show_command(us->srb));
us->proto_handler(us->srb, us);
}


and now device work without errors on kernel 2.6.7-bk12 with patch.
Back to top
View user's profile Send private message
Master_Of_Disaster
l33t
l33t


Joined: 28 Feb 2003
Posts: 610
Location: 15.05072° East, 48.13747° North (aka Mauer), Austria

PostPosted: Tue Jun 29, 2004 4:41 pm    Post subject: Reply with quote

Thanks jackie, I'll try whether this works over here.
_________________
post tenebras lux, post fenestras tux
Registered Linux User Nr. 312509
Adopt an unanswered post today!
Back to top
View user's profile Send private message
sulu
Guru
Guru


Joined: 21 May 2002
Posts: 399
Location: Dornbirn/Austria

PostPosted: Wed Jun 30, 2004 8:59 am    Post subject: Reply with quote

Master_Of_Disaster

I recently bougth an external USB-disk (160 GB) from Media-Markt and i think it reports itself as Genesys Logic something.
Could it be the same device you are using?

Im using kernel 2.6.7-gentoo on a HP-4385-Pavillion Notebook (is has only 2 USB2-slots)

I have (until now 8O ) two issues with it:
1.) It does not use USB-2 speed
2.) I need to plug in/out my memory stick before, otherwise the does not get detected.

Ad 1.) Do i need an active USB-2-hub in order to activate the disk in USB-2-mode ?
Ad 2.) As it seems, the memory stick wakes something up in the system which later enables detection of the disk. Strange ??

-------------------------------

Did you have some success with the patch mentioned in the posting from jackie ?

Cheers
Sulu
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum