Phone USB Gadget howto

The Xiaomi Poco M3 is charged via a USB-C connector in its base. However charging is not the only thing this handy connector can be used for. With a bit of experimenting it turns out that lots of hidden functions are available in the Ubuntu Touch operating system.

An example of the funtions tested here that work are:

  1. A full sized PC keyboard - just worked


     
  2. A USB stick. Tested up to 32GB (has to be formatted FAT32 with 1 partition).


     
    • Once the USB Stick is connected it ends up in a weird place. To fix this it's necessary to symlink it in to the Downloads folder:
      ln -s /media/phablet ~/Downloads/media
       
  3. USB-C to USB3 plugged in to the PC (Linux) for networking! Works even with Flight Mode active.


     
    • Use the terminal app to list the network adaptors
      ifconfig
      The address of the usb0 adaptor here was 10.15.19.82
    • Connect the cable up to the computer
    • Activate the usb networking adaptor (it's a virtual thing - there is no ethernet adaptor)
      ifconfig usb0 up
    • Set the adaptor's address
      ifconfig usb0 10.15.19.81
    • Now login using ssh to the phone (assumes sshd is setup)
      ssh phablet@10.15.19.82
    • Before unplugging shutdown the ssh connection and then
      ifconfig usb0 down
       
  4. USB Mouse!


     
  5. PowerBank operation



    Simply plugging in the iPhone in to the Xiaomi Poco M3 starts the iPhone charging from the Poco M3's battery. Note the charge icon in the top right of the iPhone's screen