Skip to content

Latest commit

 

History

History
136 lines (103 loc) · 4.12 KB

File metadata and controls

136 lines (103 loc) · 4.12 KB

devices-cli: A Golang CLI tool to list all connected devices

Prerequisites for Cloning the Repository

Before cloning this repository, ensure you have the following prerequisites installed:

  1. Git: Install Git by following the instructions on the official Git website.

    • Verify the installation:
      git --version
  2. Golang: Ensure Golang is installed and properly set up. Refer to the Golang Installation Instructions section above.

  3. Homebrew (for macOS users): Install Homebrew by following the instructions on the Homebrew website.

    • Verify the installation:
      brew --version

Once the prerequisites are installed, you can proceed to clone the repository:

git clone https://github.com/DineshKuppan/devices-cli.git
cd devices-cli

Golang Installation Instructions

To install Golang, follow these steps:

  1. Download the latest version of Go from the official website.
  2. Follow the installation instructions for your operating system.
  3. Verify the installation by running:
    go version

Setting Up macOS Tools for iOS Devices

  1. Install libimobiledevice tools using Homebrew:
    brew install libimobiledevice
  2. Verify the installation:
    idevice_id -l
    ideviceinfo -u <device_udid>

Setting Up ADB for Android Devices

  1. Install Android Platform Tools:
    brew install --cask android-platform-tools
  2. Add the Android Platform Tools to your PATH:
    export PATH=$PATH:/path/to/android/platform-tools
    Replace /path/to/android/platform-tools with the actual installation path.
  3. Verify the installation:
    adb devices

Enabling Developer Settings

For iOS Devices

  1. Open the Settings app on your iOS device.
  2. Navigate to Privacy & Security > Developer Mode.
  3. Enable Developer Mode and restart your device if prompted.

For Android Devices

  1. Open the Settings app on your Android device.
  2. Navigate to About Phone (or About Device, depending on your device).
  3. Locate the Build Number and tap it 7 times to enable Developer Options. You may need to enter your device's PIN or password.
  4. For detailed instructions specific to your device, refer to this guide on XDA Developers.
  5. Go back to Settings and open Developer Options.
  6. Enable USB Debugging.

For IOS Devices

For example, the connected device id will be displayed with UUID and use ideviceinfo command to fetch info about the devices

To learn further information about the commands available for library libimobiledevice, please visit this link Link

idevice_id -l
ideviceinfo -u 00000000-0000000XXXXXXXXX

For Android

To fetch connected device model details and sdk version

adb -s <device_serial_id> shell getprop ro.product.model
adb -s <device_serial_id> shell getprop ro.build.version.release
Output
Pixel 7a
15

Building and Running the Binary

To build and run the devices-cli binary, follow these steps:

  1. Build the binary using the go build command:
    go build -o devices
  2. Run the binary:
    ./devices

This will execute the devices-cli tool and display the list of connected devices.

List of connected Android & IOS devices...
Connected Devices: iOS
- iOS Device: 00000000-0000000XXXXXXXXX
Connected Devices: Android
- Android Device: <actual_device_serial_id>

License

This project is licensed under the MIT License. See the LICENSE file for details.

Reporting Issues

If you encounter any issues or have suggestions for improvements, please open an issue on the GitHub Issues page. Provide as much detail as possible, including steps to reproduce the issue and any relevant logs or screenshots.