Take the 2-minute tour ×

I am having some trouble in automating the task. I am testing some android based mobiles in Linux machine. The automation script uses the device ID under /dev/bus/usb/001/"053" it will be always under bus 001 only. But the dev will be random like if I insert one mobile then the dev ID will be 053, if remove and insert it again then the dev ID will be 054.

The problem is, when some tests runs on the device and if device gets rebooted then new dev ID is showing for the rebooted one and my scripts failing due to new dev ID.

Is there any way to force USB devices to use same dev ID instead of new one, so that there will be no issues to my tests even after device reboots?

share|improve this question
It might be helpful with some more information about how this script it working. There might be other ways to solve your problem than what you are asking for directly. –  bjaanes Oct 29 '12 at 17:07
The script is nothing but a monkey random events.. When ever scripts starts it will bound with "/dev/bus/usb/001/"053" and starts running and capturing logs. About the problem i have already explained in above. –  m s kumar Oct 30 '12 at 3:43
add comment

1 Answer

It doesn't seem possible to force a particular ID. You may instead find it useful to dynamically identify the device ID you want to bind your script to.

devid=/dev/bus/usb/$(lsusb | grep <yourdevice> | cut -d":" -f1 | cut -d" " -f2,4 --output-delimiter="/")

^ where <yourdevice> is something appropriately unique to identify your device.

You would then be able to use $devid where you previously used /dev/bus/usb/001/053.

share|improve this answer
add comment

Your Answer


