Skip to content

Conversation

cocool97
Copy link
Owner

@cocool97 cocool97 commented Aug 17, 2025

This PR add find_all_connected_adb_devices() function, returning a list of ADBDeviceInfowith vendor_id, product_id and a device_description.
[adb_cli] Also adds a --list argument to usb subcommand to list all connected ADB devices

BREAKING

  • Changes signature of get_single_connected_adb_device

Close #133

@pavi2410
Copy link

Tested with my Android device connected to Macbook via USB.

adb_client/adb_cli on  133-list-attached-devices is 📦 v2.1.16 via 🦀 v1.89.0 on ☁️   
❯ cargo r -- usb -l
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.12s
     Running `/Users/pavi2410/Playground/adb_client/target/debug/adb_cli usb -l`
Index  Vendor ID  Product ID  Device Description
-----  ---------  ----------  ----------------
 #0      2d95        6001     vivo V2025

I wonder if it’s possible to maintain CLI compatibility with the adb command. For instance, the command to list devices using adb is adb devices -l, while with adb_cli, it’s adb_cli usb -l. This would make it easier for users to understand the features without having to create a new mapping. Since there’s a lot of documentation online for adb commands, it would be beneficial if adb_cli could serve as a drop-in replacement for adb.

@cocool97
Copy link
Owner Author

You already have adb_cli devices -l iirc, that should have the same output as upstream adb command

@pavi2410
Copy link

Sorry, but I don't see it there.

adb_client/adb_cli on  133-list-attached-devices is 📦 v2.1.16 via 🦀 v1.89.0 on ☁️   
❯ cargo r -- devices -l
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.29s
     Running `/Users/pavi2410/Playground/adb_client/target/debug/adb_cli devices -l`
error: unrecognized subcommand 'devices'

Usage: adb_cli [OPTIONS] <COMMAND>

For more information, try '--help'.

adb_client/adb_cli on  133-list-attached-devices is 📦 v2.1.16 via 🦀 v1.89.0 on ☁️   
❯ cargo r --           
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.05s
     Running `/Users/pavi2410/Playground/adb_client/target/debug/adb_cli`
Rust ADB (Android Debug Bridge) CLI

Usage: adb_cli [OPTIONS] <COMMAND>

Commands:
  host   Server related commands
  local  Device related commands using server
  emu    Emulator related commands
  usb    USB device related commands
  tcp    TCP device related commands
  mdns   MDNS discovery related commands
  help   Print this message or the help of the given subcommand(s)

Options:
      --debug    
  -h, --help     Print help

@cocool97
Copy link
Owner Author

Yes sorry this is adb_cli host devices -l

@cocool97
Copy link
Owner Author

I can try to see if everything can be merged under a single subcommand

@pavi2410
Copy link

I can try to see if everything can be merged under a single subcommand

Achieving adb CLI compatibility would be awesome IMO. If you divide the tasks into issues, I'd happy to help you with some of them.

@cocool97
Copy link
Owner Author

This should not be something too big :)
The only thing is that when using adb you don't have to choose between USB, emulator or server commands as everything goes through the adb server. I'll see how to reflect this difference without diverging too much from the official CLI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Should also return a list of attached ADB USB devices
2 participants