Choosing bus and device number during embedded rust setup

please help me to take a decision about choose a bus and device numbers in my system
when i run lsusb commande

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 04f2:b56c Chicony Electronics Co., Ltd
Bus 001 Device 002: ID 0bda:b008 Realtek Semiconductor Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

in this which bus and device number should i choose

No idea. I see what looks like a USB 3.0 hub, a USB 2.0 hub, and a Realtek NIC. Might be the Chicony.

To be sure, Linux has this nifty tool called dmesg. It shows you the kernel log which includes messages related to hardware.

  1. Run dmesg -w or dmesg | tail -f to follow the kernel log.
  2. If connected, unplug your embedded device. Notice the kernel log reports a device disconnected.
  3. Plug your embedded device into the computer USB port. Notice the kernel log reports a device connected with details that should include Bus and Device numbers. If not there should be enough info to cross reference with lsusb to figure it out.

[ 1.776063] usb 1-4: new full-speed USB device number 2 using xhci_hcd
[ 1.925231] usb 1-4: New USB device found, idVendor=0bda, idProduct=b008
[ 1.925233] usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1.925235] usb 1-4: Product: Bluetooth Radio
[ 1.925237] usb 1-4: Manufacturer: Realtek
[ 1.925238] usb 1-4: SerialNumber: 00e04c000001
[ 2.052063] usb 1-5: new high-speed USB device number 3 using xhci_hcd

So no explicit bus and device numbers in dmesg, but you do get idVendor=0bda and idProduct=b008. I think usb 1-4 is bus 1 and device 4.

Now run lsusb again and cross reference.

Using your first lsusb output as an example (because the bus and device numbers may be different after replugging the device). What I though was a Realtek NIC is actually the bluetooth device you replugged.

If you have multiple devices plugged in with the same idVendor and idProduct, you'll need a different method. If I'm right about usb 1-4, then that would work with multiple similar devices.