0

Whenever I reconnect my USB device (a OnePlus 10T smartphone) to a CentOS 7 server or reboot it its device # on the bus changes as can be seen here:

Before: Bus 002 Device 052: ID 22d9:2765 OPPO Electronics Corp. Oppo N1
After:  Bus 002 Device 055: ID 22d9:2765 OPPO Electronics Corp. Oppo N1

Is there a way to lock those bus and device # to any fixed values and map them to device vendor:product IDs 22d9:2765 somewhere?

Thanks in advance!

  • 1
  • @Peregrino69: Thanks so much - I'll need to experiment with that udev method now. – dandreye Feb 08 '23 at 21:01
  • @Peregrino69: Seems like (unless I'm misinterpreting it) it's about giving the device a permanent name though (somewhere under /dev). My challenge is somewhat different then - to keep it on the same USB bus/device # assuming it's possible at all. – dandreye Feb 08 '23 at 21:32
  • 1
    Why exactly do you think you need to do this? Please make sure there is no XY problem here. [Edit] the question if there is. – Kamil Maciorowski Feb 08 '23 at 22:06
  • @Kamil Maciorowski: to only have to map my USB device to a VM running on that server once. – dandreye Feb 08 '23 at 22:08
  • Sorry, I did slightly misunderstand. I did some testing, and the same way every time I connect my phone, lsusb shows it on the same Bus but as different Device. I found the device info first under /sys/bus/usb/devices/usb2/; every reconnection increased devnum after a reboot under /sys/bus/usb/devices/usb1 – Peregrino69 Feb 08 '23 at 23:14
  • @Peregrino69: Same here, in fact I noticed that whenever I reconnect or reboot mine its devnum goes up by 3 (always on the same bus) while whenever I map it to a VM running on the server it goes up by 1. I'll be fine with it changing though if the method someone suggested in my parallel thread works: https://unix.stackexchange.com/questions/734831/issues-mapping-usb-device-to-vm . – dandreye Feb 08 '23 at 23:23
  • Let's hope you get there. At least I've learned again something new :-) – Peregrino69 Feb 08 '23 at 23:50

0 Answers0