Monday, August 06, 2012


Got an eSATA / USB3.0 Dual Bay HDD Dock:
  1. http://www.vantecusa.com/en/product/view_detail/494
  2. http://www.amazon.com/gp/product/B007XJIYRC/
The first impression is incredibly both bay cannot work at same time, then I found it's actually because of CONFIG_SCSI_MULTI_LUN not default enabled: under USB mode, the dock is assuming having 2 luns, SCSI-3 standard has REPORT_LUN command but seems this device doesn't responds REPORT_LUN query, so it assumes only 1 lun, found 1 drive only; we can do a manual scan:

echo '- - 1' >/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.0/host12/scsi_host/host12/scan

After that the kernel scsi_mod middle layer would scan lun 1, found the 2nd drive; or could learn from Linux USB Frequently Asked Questions: or add scsi_mod.max_luns=2 to kernel boot parameter

(http://www.linux-usb.org/), "options scsi_mod max_luns=2" (updated to latest linux kernel v3.5)
$ dmesg
[15011.760697] usb-storage 2-1.1:1.0: usb_probe_interface
[15011.760709] usb-storage 2-1.1:1.0: usb_probe_interface - got id
[15011.760806] scsi12 : usb-storage 2-1.1:1.0
[15012.762244] scsi 12:0:0:0: Direct-Access     ST910006 40NS             CC01 PQ: 0 ANSI: 5
[15012.762847] sd 12:0:0:0: Attached scsi generic sg2 type 0
[15012.763368] sd 12:0:0:0: [sdb] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB)
[15012.763787] scsi 12:0:0:1: Direct-Access     WDC WD16 00AAJS-00YZCA0   01.0 PQ: 0 ANSI: 5
[15012.764013] sd 12:0:0:1: Attached scsi generic sg3 type 0
[15012.764584] sd 12:0:0:0: [sdb] Write Protect is off
[15012.764587] sd 12:0:0:0: [sdb] Mode Sense: 23 00 00 00
[15012.765111] sd 12:0:0:1: [sdc] 312581808 512-byte logical blocks: (160 GB/149 GiB)
[15012.765865] sd 12:0:0:0: [sdb] No Caching mode page present
[15012.765871] sd 12:0:0:0: [sdb] Assuming drive cache: write through
[15012.766619] sd 12:0:0:1: [sdc] Write Protect is off
[15012.766625] sd 12:0:0:1: [sdc] Mode Sense: 23 00 00 00
[15012.767612] sd 12:0:0:1: [sdc] No Caching mode page present
[15012.767618] sd 12:0:0:1: [sdc] Assuming drive cache: write through
[15012.769723] sd 12:0:0:0: [sdb] No Caching mode page present
[15012.769726] sd 12:0:0:0: [sdb] Assuming drive cache: write through
[15017.751786] sd 12:0:0:1: [sdc] No Caching mode page present
[15017.751795] sd 12:0:0:1: [sdc] Assuming drive cache: write through
[15022.187904]  sdc: sdc1 sdc2 < sdc5 >
[15022.216575] sd 12:0:0:1: [sdc] No Caching mode page present
[15022.216580] sd 12:0:0:1: [sdc] Assuming drive cache: write through
[15022.216584] sd 12:0:0:1: [sdc] Attached SCSI disk
[15022.222847]  sdb: sdb1 sdb2 sdb4 sdb5
[15022.227795] sd 12:0:0:0: [sdb] No Caching mode page present
[15022.227800] sd 12:0:0:0: [sdb] Assuming drive cache: write through
[15022.227802] sd 12:0:0:0: [sdb] Attached SCSI disk
Well recognized:
$ lsscsi -gv
[12:0:0:0]   disk    ST910006 40NS             CC01  /dev/sdb   /dev/sg2
[/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.0/host12/target12:0:0/12:0:0:0]
[12:0:0:1]   disk    WDC WD16 00AAJS-00YZCA0   01.0  /dev/sdc   /dev/sg3 
[/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.0/host12/target12:0:0/12:0:0:1]
When attached to USB 2.0 ports, it archives 30MB/s sequential read/write performance, not as optimal as eSATA 100MB/s; This USB is actually "Mass Storage" / "SCSI" / "Bulk-Only" should be able to use uas (USB Attached SCSI) protocol, but not sure why uas drive not attached, a forced bind neither work

$ lsusb -d 174c:55aa -v
Bus 002 Device 003: ID 174c:55aa ASMedia Technology Inc. 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x174c ASMedia Technology Inc.
  idProduct          0x55aa 

[...]
  Configuration Descriptor:
    Interface Descriptor:

      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
# echo 2-1.1:1.0 > /sys/bus/usb/drivers/usb-storage/unbind
# echo 2-1.1:1.0 > /sys/bus/usb/drivers/uas/bind
write error: No such device
need another time to figure out why.

Monday, June 25, 2012


一月份去洛杉矶的时候顺便walk in进加拿大领事馆办签证,隔天取到。

六月份最近Southwest飞Seattle, 玩一天再Amtrak火车赴Vancouver, 四小时到达,住与 US
Consulate Vancouver (1075 W Pender St) 只隔一条街的 Days Inn (921 W Pender
St); 第二天一早去US Consulate; VO只问了学位情况,我确实没有北美的学位,只能
如实回答 Bachelor from China Mainland, 他说没关系,看了一会材料最后说
Approved, 3工作日取,实际上第二天晚就收到Loomis来信说ready for pickup; 这三
天实际上租车往Banff去了,但没有到达,在Kamloops折返。回来在机场附近 5001
Miller Rd 的 Loomis 办事处取了护照,然后还车去机场租车处。在YVR机场里面找到
了 Pacific Coach 大巴去了Victoria; 再玩一天然后乘 Clipper Ferry 回 Seattle并
入境美国。边境官只把I94移到了新的visa页上;没有换I94, 应该就是传说中的 Auto
Revalidation 吧。最后乘Southwest离开。
整个行程不一定是最优惠的,但在陌生的地方想体验一下各种不同的交通方式:飞机、火车、市内地铁、大巴、轮渡、自驾车。

在加拿大租车期间算是见识了加国有着最疯狂的 truck drivers, 这些大货车经常跑过
来在超车道行驶,当我在双车道山路上(限速100km/h)以120km/h行驶时发现还有truck
试图在左道超过我,我估计它有130km/h; 换Mile算,也就是此truck试图在左道以80迈
超过小车的75迈。我算了让他过吧,在国内老是记得有小车被大卡压住让我有心理阴影
,我减速一点让它快点过吧。最终在 1 West 让我看到了一辆横躺在路中间的大卡。右
边就是急流飞涧哪,还好算它有运气没有掉河里,也没有小车倒霉被它压住。不过整个
路面被阻住了半小时多。

Monday, May 21, 2012

gimp-2.8-screenshoting-is-great.html


Friday, May 18, 2012


一个行尾逗号引发的悲剧

一个设备上运行的http管理界面的online help, 其中有一个help.js定义help页面名称,用于链接管理界面上随处可见的"?", 点击"?"即可直接打开online help并跳转到对应help页面;

var helpMap = {
        none:                                           "Overview.html",
        SystemSummary:                          "SystemSummary.html",
        InventoryCPU:                           "InventoryCPU.html",
        [...]
        ClearConfigs:               "ClearConfigs.html"
};

上个月在这张查找表中添加最末一项,一不小心多写了个逗号;这在C语言数组中很常见,最后一项的行尾逗号可有可无,但写起来比较美观、一致


        ClearConfigs:               "ClearConfigs.html",

本人常用Firefox/Chrome用起来都没问题;直到一个月后某Windows用户用IE打开管理界面,这个也没问题,但尝试online help的时候悲剧了。我记得二月中的一个版本当时为修正支持Chrome问题时测试过IE没问题,为些只能从那一个 good build 开始了二分查找,过程类似于git bisect

最后定位问题在于这个行尾逗号,必须删除。怎么都不敢相信,IE6,IE7,IE8,IE9全都如此脆弱

Sunday, February 12, 2012

从 Santa Clara County 图书馆借来的最新《The Linux Programming Interface》2010年出版




p1







p1