怎么找到占用usb的模块,linux下Jlink连接失败

  问题是这样产生的,我在linux下安装jlink,启动JLinkExe执行,总是提示不能通过usb连接:

SEGGER J-Link Commander V5.10q (Compiled Mar  4 2016 16:04:12)
DLL version V5.10q, compiled Mar  4 2016 16:04:07

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 002 Device 005: ID 1bcf:05c2 Sunplus Innovation Technology Inc. 
Bus 002 Device 004: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 002 Device 003: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 002: ID 062a:4101 Creative Labs Wireless Keyboard/Mouse
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 004: ID 058f:b002 Alcor Micro Corp. Acer Integrated Webcam
Bus 001 Device 003: ID 1366:0101 SEGGER J-Link PLUS
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

可以看到SEGGER J-Link PLUS的Bus是1,Device 是3。于是执行lsusb -t

/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M
        |__ Port 2: Dev 3, If 0, Class=Vendor Specific Class, Driver=secbulk, 12M
        |__ Port 5: Dev 4, If 0, Class=Video, Driver=uvcvideo, 480M
        |__ Port 5: Dev 4, If 1, Class=Video, Driver=uvcvideo, 480M

找到Bus下的device 3,最后面它的Driver = secbulk,这时我才想起之前找了个linux版的DNW,加载了这个驱动模块,于是卸载,问题解决。

posted @ 2016-03-14 22:15  thammer  阅读(1475)  评论(0编辑  收藏  举报