适合嵌入式Linux 2.4内核的usb hotplug

 
1. check if /proc/scsi/usb-storage-# exist or not
2. if exist. check if /proc/scsi/usb-storage-#/# exist or not
3. if exist. check the file /proc/scsi/usb-storage-#/# if it says Attach: Yes
4. if Yes. the # can be converted to device name:
0 = sda, 1=sdb, 2=sdc
5. But I don't know which USB port it connects to. and you don't need to know also.

for example: /proc/scsi/usb-storage-0/0 says Attach: No, then /dev/sda is not attached
/proc/scsi/usb-storage-1/1 says Attach: Yes, then it is attached, you can mount it.
If you plug in usb storage with brandname A first, the it is usb-storage-0, then you unplug it, but that directory still exists, and now you plug in Brandname B, the storage-1 directory will be created, and storage-0 is still there.

 

linux 2.6

http://blog.chinaunix.net/u2/72751/showart_1082492.html  待研究

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值