#17 Support for JMicron USB to (S)ATA bridges

closed-fixed
nobody
None
5
2017-05-01
2009-05-24
Jan Friesse
No

Attached is patch for JMicron USB to (S)ATA bridges. Some parts of code (like magic numbers) are taken from smartmontools (I hope it will be not problem, because smartmontools are GPL, and hdparm seems to be BSD or GPL licence, but as you can see, code is mine and licensed same as hdparm).

In my testing, at least -v, -M, -B and -I options are supported. This is enough for me, because (and this is reason why I wrote this patch) -B removes problem with very high increasing load_cycle_count on WD Scorpio.

Patch is developed on top of hdparm-9.15. Whole work is designed to allow future simple additions of different ATP (ATA Pass Through) devices.

Discussion

  • Jan Friesse

    Jan Friesse - 2009-05-24

    Support for JMicron USB to (S)ATA bridges try 1

     
  • Mark Lord

    Mark Lord - 2009-07-16

    I have no idea what this patch is trying to do. Standard hdparm *already* implements "SAT" (SCSI ATA Translation) commands for ATA passthrough, and it already works with several USB bridges. So if something weird / non-standard is needed for JMicron, I'd much rather see a smaller patch that addresses the differences. Rather than a complete new implementation.

    thanks

    Mark

     
  • Jan Friesse

    Jan Friesse - 2009-07-17

    Mark,
    problem with JMicorn is, that ATA PT has most cdb items on different positions (like lbal, where SG_ATA_16 has it on position 8, and JMicron expect on position 7).

    Second problem is, that JMicron doesn't support SG_CDB2_CHECK_COND.

    Last problem is, that JMicron returns very strange status (io_hdr.status, ...) and only one reliable solution seems to be send "special" cdb command (apt_jmicron_int_get_registers), where one of register is error.

    Because of this, I choose to little larger implementation, which detects:
    - If device is really JMicron (so we didn't break some standard device by meaningless commands)
    - if it really is, use nonstandard cdb and status handling

    Second option (and this can make patch smaller) is to add option to hdparm, which will force to use JMicrons cdb and status handling, but this is not transparent for user and I think, mess sgio.c more than original patch.

    Regards,
    Honza

     
  • Mark Lord

    Mark Lord - 2009-07-29

    Cool. Okay, if we can keep this small, then I'll add it, probably for hdparm-9.18.
    Email me directly please, so I don't forget. I do not read the stuff here very often. :)

    mlord@pobox.com

     
  • Nobody/Anonymous

    After searching a long time on the internet, I've finally found the solution to being able to read extra information from my external HDD, and importantly to spin it down at will!!
    This patch works, and should be included in the next release of hdparm.

     
  • Nobody/Anonymous

    This patch is needed, JMicron doesn't support SAT nor something similar.

     
  • Pavel Kankovsky

    Pavel Kankovsky - 2010-12-31

    Great patch!

    I applied it to 9.35, resolved a few minor conflicts and one kernel compatibility problem (see below) and it worked flawlessly. I used it to perform the "security erase" on some failing hard drives pulled out of a disk array before RMA. The patch made it possible to connect the drives via a standalone USB-ATA adapter.

    As far as I can tell, the vast majority of such adapters is built upon JMicron chips (esp. JM20337).

    Regarding the aformentioned kernel incompatibility: the original patch does not work with RHEL 5 kernel (based upon 2.6.18) due to a small difference in sysfs layout. I had to change the following part of sysfs_find_attr_file_path() in sysfs.c.
    stat("/sys/devices", &st);
    stop_inode = st.st_ino;
    strcpy(path, start_path);
    to
    stat("/sys", &st);
    stop_inode = st.st_ino;
    strcpy(path, start_path);
    strcat(path, "/device");
    to make it work. I believe the new code is compatible with both old and new kernel versions. (I'd like to attach the updated patch but I do not know how to do that.)

     
  • Nobody/Anonymous

    @p-eak Could you upload your patch elsewhere and link it here, please?

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2011-10-26

    I successfully applied this patch to 9.32 with very minor modifications, and added my device:

    {0x152d, 0x0551, 0x0100, apt_ds_jmicron,

    I would really like to see this get merged in; it's been languishing here for a couple of years and it appears that this chipset is becoming popular. If you think the patch is not suitable as it is, I might have time to work on rewriting it in a different way.

     
  • Jan Friesse

    Jan Friesse - 2012-09-24
    • status: open --> closed-fixed
     
  • Jan Friesse

    Jan Friesse - 2012-09-24

    Closing this request. I'm no longer interested in pushing this patch because:
    - It's there for 3 years and maintainer is not willing to accept it
    - it's probably not working any longer
    - and MOST important, smartctl from smartmontools-5.43 now have option --get and --set, to set apm, aam, standby, ..., and this is everything I need. Also smartctl has wide support for bridges (not only JMicron, but also sunplus (Verbatim), ...) nice HUGE database of devices, ...

    So setting to Fixed, because it's fixed (even by different SW :( ).

     
  • Mark Lord

    Mark Lord - 2017-05-01

    I lost track of this patch years ago and only just rediscovered it. MERGED.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks