How to find out the ID of a CF card provider

I am writing a bash script that fills cf maps with an image. Since only the specified cards are allowed, I would like to check if the correct type of cf card is connected in the USB cf writer.

I know that I can somehow read out the vendor ID and the firmware version of the cf card (I saw it in the embedded system), but I don’t know how to do this in my Linux window (openSUSE 10.3) and usb cf card writer.

Does anyone else know how?

Thanks a lot Chris

+4
source share
4 answers

Besides using lsusb, you can try dbus.

Here is an example python code that should display all scsi_host parents in a hardware hierarchy.

import dbus bus = dbus.SystemBus() hal = bus.get_object ('org.freedesktop.Hal', u'/org/freedesktop/Hal/Manager') hal_manager = dbus.Interface(hal, u'org.freedesktop.Hal.Manager') volume_udi_list = hal_manager.FindDeviceByCapability('scsi_host') for udi in volume_udi_list: # inspect all scsi_host devices dev = bus.get_object ( u'org.freedesktop.Hal', udi) volume = dbus.Interface(dev, u'org.freedesktop.Hal.Device') # get their parent parent = volume.GetProperty('info.parent') dev = bus.get_object ( u'org.freedesktop.Hal', parent) volume = dbus.Interface(dev, u'org.freedesktop.Hal.Device') # Here we can find vendor id for usb-storage devices props = volume.GetAllProperties() print "\n".join(("%s: %s" % (k, props[k]) for k in props)) 
+2
source

You can try to do

 cat /proc/scsi/scsi 

And see if you have any relevant information. Since the CF card has a PID / VID, this does not mean that it is exported by a USB card reader.

+1
source
 hdparm -i /dev/sda 

can tell you about the model, firmware version and serial number of most ATA drives (including, I believe, a CF drive).

 smartctl -a /dev/sda 

also tells you about a random drive, including the model, serial number, firmware, capacity, as well as some statistics on the general condition of the drive.

I believe that this will work well for a CF drive, as well as for a SATA or PATA drive, although I don’t have one now to check it.

+1
source

Take a look at the output of lsusb or cat /proc/scsi/usb-storage/*

0
source

All Articles