2016年10月8日 星期六

Linux LibUsb

Linux LibUsb


LibUsb for Linux

  Download Source Code: sourceforge
 $ apt-get install libudev-dev
 $ ./configure

 $ make

 Download Example 
   https://github.com/libusb/libusb/tree/master/examples
   
 Download Hot-Plug Example
   CD /libusb-1.0.20/examples/
    # make
    # listdevs
      get usb vendor_id and  product_id


   update hotplugtest.c
    line  75, 78  Update vendor_id and  product_id
    # ./hotplugtest
   http://libusb.sourceforge.net/api-1.0/hotplug.html

但是那個 LIBUSB_HOTPLUG_PRODUCTID_ANY 怎測試都失敗









Linux usbview

Linux usbview


Linux usbview
   Download Source Code: Source code
  Compiler Source Code:
   unpack usbview-2.0.tar.gz
   cd usbview-2.0
   ./configure

   apt-get install libgtk-3-dev

   make

   ./usbview




   

2016年10月4日 星期二

SCSI Bus Rescan

SCSI Bus rescan
但是一些 SCSI Control Card已經是很久以前的
但 SCSI Device ID 變更, Linux 會還是記著, 不會釋放


只能斷電重新開機或是使用 SCSI bus Delete 指令

1:
 #  echo "- - -" > /sys/class/scsi_host/hostX/scan
  hostX:  0 to n

  #  echo "- - -" > /sys/class/scsi_host/host0/scan
  #  echo "- - -" > /sys/class/scsi_host/host6/scan

 # lsscsi

 # cat /proc/scsi/scsi



2:
 # echo "1" > /sys/class/block/sdX/device/rescan
  sdX:  A to n
  # echo "1" > /sys/class/block/sdb/device/rescan
  # echo "1" > /sys/class/block/sdc/device/rescan


3:
  # echo "1" > /sys/class/scsi_device/6:0:1:0/device/rescan
    6:0:1:0  => Host 6,  ID 1


4:
 # apt-get install scsitools
 # rescan-scsi-bus
 # lsscsi


5:  SCSI bus Delete
echo 1 > /sys/bus/scsi/drivers/sd/6\:0\:6\:0/delete



//========================
lsscsi Source Code
 http://sg.danny.cz/scsi/lsscsi.html
 https://github.com/hreinecke/lsscsi