USB Drive detection problem and solution

Nov 11, 2014 at 3:37 PM
Edited Nov 11, 2014 at 3:38 PM
Just want to say, awesome project!
Wanted to pass this along in case you wanted to update your code.
I had 2 external USB Seagate drives, smartctl would detect one properly as -d sat and the other not at all. Both drives needed to be addressed as "-d sat". I saw your code in DeviceDetection.vb:
If IO.File.Exists(My.Application.Info.DirectoryPath & "\additional.xml") Then

However, I needed the drive to show up properly under External Devices , here are my changes right before this in DeviceDetection.vb:
      If Not IsNothing(usbdevices) Then
            PrintDebug("*** Adding USB devices ***", False, True)
            For d As Integer = 0 To usbdevices.Count - 1
My changes :
       If IO.File.Exists(My.Application.Info.DirectoryPath & "\USBadditional.xml") Then
            PrintDebug("*** Adding additional devices ***", False, True)
            Dim m_xmldoc As New XmlDocument
            Dim m_nodelist As XmlNodeList
            Dim m_node As XmlNode
            m_xmldoc.Load(My.Application.Info.DirectoryPath & "\USBadditional.xml")
            m_nodelist = m_xmldoc.SelectNodes("/additionaldevices/device")
            For Each m_node In m_nodelist
                Dim cmd As String = m_node.Attributes.GetNamedItem("command").Value
                ReDim Preserve usbdevices(usbdevices.Count)
                usbdevices(usbdevices.Count - 1) = cmd
            Next
        End If

      If Not IsNothing(usbdevices) Then
            PrintDebug("*** Adding USB devices ***", False, True)
            For d As Integer = 0 To usbdevices.Count - 1
            ...
Then in the application exe directory i have this in USBadditional.xml:
<?xml version="1.0" encoding="utf-8"?>
<additionaldevices>
  <device description="/dev/sdg" command="/dev/sdg -d sat " />
</additionaldevices>
Coordinator
Nov 11, 2014 at 4:11 PM
Hi!

Thank you for your appreciation! :)

The first thing that I think is that your second USB Seagate ID is not in smartctl database; try to run Toolbox, and see his output on "USB Scan": if you read a string like "/dev/sdg: Unknown USB bridge [0x????:?????]" is highly probable that your problem on /dev/sdg is here.

If you want, provide me the output of Toolbox and, if the problem is here, I can provide you an updated version of database! ;)

Thanks,
Sam
Nov 11, 2014 at 6:17 PM
Yes I did get that:
smartctl.exe -P show /dev/sdg
smartctl 6.3 2014-07-26 r3976 [x86_64-w64-mingw32-win7-sp1] (sf-6.3-1)
Copyright (C) 2002-14, Bruce Allen, Christian Franke, www.smartmontools.org

/dev/sdg: Unknown USB bridge [0x0bc2:0x50a7]
Please specify device type with the -d option.

This is not a problem with your code, smartctl can't detect it properly without the -d sat option. So I needed a way to override.

But when I run the same command to look up in the DB but with -d sat it finds it:
smartctl.exe -d sat -P show /dev/sdg
smartctl 6.3 2014-07-26 r3976 [x86_64-w64-mingw32-win7-sp1] (sf-6.3-1)
Copyright (C) 2002-14, Bruce Allen, Christian Franke, www.smartmontools.org

Drive found in smartmontools Database. Drive identity strings:
MODEL: ST2000DM001-1CH164
FIRMWARE: CC82
match smartmontools Drive Database entry:
MODEL REGEXP: ST(1000|1500|2000|2500|3000)DM00[0-3]-.*
FIRMWARE REGEXP: .*
MODEL FAMILY: Seagate Barracuda 7200.14 (AF)
ATTRIBUTE OPTIONS: 188 Command_Timeout
240 Head_Flying_Hours

The one that works with no problem is (notice: no need to put the -d sat):
smartctl.exe -P show /dev/sdf
smartctl 6.3 2014-07-26 r3976 [x86_64-w64-mingw32-win7-sp1] (sf-6.3-1)
Copyright (C) 2002-14, Bruce Allen, Christian Franke, www.smartmontools.org

Drive found in smartmontools Database. Drive identity strings:
MODEL: ST3000DM001-1E6166
FIRMWARE: SC48
match smartmontools Drive Database entry:
MODEL REGEXP: ST(1000|1500|2000|2500|3000)DM00[0-3]-.*
FIRMWARE REGEXP: .*
MODEL FAMILY: Seagate Barracuda 7200.14 (AF)
ATTRIBUTE OPTIONS: 188 Command_Timeout
240 Head_Flying_Hours

Thanks, Let me know your thoughts.
Nov 11, 2014 at 7:05 PM
Edited Nov 11, 2014 at 7:22 PM
OK, I got it, thanks!
I added this to drivedb.h and it works now:
{ "USB: Seagate GoFlex Desk", // 2TB
"0x0bc2:0x50a7",
"",
"",
"-d sat"
},

The other drive's USB ID was 0x0bc2:0x3312 and apparently didn't require an entry in the drivedb.h
all is well, sorry for the flood ;)

Can you let me know how to get this added to smartmontools db?
Thanks again
Marked as answer by Eruestan on 11/18/2014 at 7:02 AM
Coordinator
Nov 11, 2014 at 8:20 PM
Edited Nov 11, 2014 at 8:29 PM
The other working USB ID is stored into this portion of DB:
  { "USB: Seagate Expansion External; ", // 2TB, 3TB
    "0x0bc2:0x33(00|12|20|32)",
    "",
    "",
    "-d sat"
  }
To make the Smartmontools team add the USB ID, you have to send a mail to smartmontools-database@lists.sourceforge.net with the results of your test (in this case provide the bridge ID, the working option and the model of external device, the Seagate Expansion External 2TB).
At the same address you can send also the output of devices that are not in smartctl database, just in case this happens. ;)

Greetings,
Sam
Nov 11, 2014 at 8:38 PM
Yikes, didn't see that :)
Thanks Sam!
-Tom