问题是这样产生的,我在linux下安装jlink,启动JLinkExe执行,总是提示不能通过usb连接:
SEGGER J-Link Commander V5.10q (Compiled Mar ::)
DLL version V5.10q, compiled Mar :: Connecting to J-Link via USB...FAILED: Can not connect to J-Link via USB.
折腾好久,上segger的论坛,有人遇到和我一样的问题,也是在ubuntu下,http://forum.segger.com/index.php?page=Thread&postID=4116&highlight=ubuntu#post4116,但是没出现解决方法,不过里面一个人的回答给我一个思路,他说使用strace看看JLinkExe启动期间到底是哪个系统调用失败了,于是尝试,发现是调用ioctrl操作usb设备时失败,错误是device is busy.那么肯定是哪个模块占用了这个设备,于是查找资料,如何找到占用usb设备的模块。http://unix.stackexchange.com/questions/60078/find-out-which-modules-are-associated-with-a-usb-device,这个帖子给出了好多种方法,以最后一个方法尝试,使用 lsubs -t ,步骤如下:
首先查看usb信息:
thomas@thomas-laptop:~/mydriver$ lsusb
Bus Device : ID 1bcf:05c2 Sunplus Innovation Technology Inc.
Bus Device : ID 067b: Prolific Technology, Inc. PL2303 Serial Port
Bus Device : ID 05e3: Genesys Logic, Inc. -port hub
Bus Device : ID : Intel Corp. Integrated Rate Matching Hub
Bus Device : ID 1d6b: Linux Foundation 2.0 root hub
Bus Device : ID 1d6b: Linux Foundation 3.0 root hub
Bus Device : ID 062a: Creative Labs Wireless Keyboard/Mouse
Bus Device : ID 1d6b: Linux Foundation 2.0 root hub
Bus Device : ID 058f:b002 Alcor Micro Corp. Acer Integrated Webcam
Bus Device : ID : SEGGER J-Link PLUS
Bus Device : ID : Intel Corp. Integrated Rate Matching Hub
Bus Device : ID 1d6b: Linux Foundation 2.0 root hub
可以看到SEGGER J-Link PLUS的Bus是1,Device 是3。于是执行lsusb -t
/: Bus .Port : Dev , Class=root_hub, Driver=ehci-pci/2p, 480M
|__ Port : Dev , If , Class=Hub, Driver=hub/6p, 480M
|__ Port : Dev , If , Class=Vendor Specific Class, Driver=secbulk, 12M
|__ Port : Dev , If , Class=Video, Driver=uvcvideo, 480M
|__ Port : Dev , If , Class=Video, Driver=uvcvideo, 480M
找到Bus下的device 3,最后面它的Driver = secbulk,这时我才想起之前找了个linux版的DNW,加载了这个驱动模块,于是卸载,问题解决。