Enabling Qualcomm diagnostic mode on Jolla

Since Jolla uses Qualcomm MSM8930AA, it is possible to use Qualcomm diagnostic tools in theory. They are not available by default and the way to enable this functionality is not yet discovered. I poked various options of usb-moded but diagnostic mode did not came out. I ended up editing some files and finally managed to get the diagnostic mode on my Jolla.

DISCLAIMER: you may void your warranty, especially poking with various Qualcomm-related tools. You have been warned.

usb-moded files are located under /etc/usb-moded and there are several ini files defining modes. USB mode selection UI gives options for PC Suite, Developer mode, Charging only. Those two modes are defined in /etc/usb-moded/dyn-modes/developer_mode-android.ini and pc_suite-android.ini. The file contains USB gadget settings like vendor and product ID, and most importantly, USB mode.

What is exposed via USB interface is determined by /sys/class/android_usb/android0/functions file. Directly modifying sysfs values seems not to work, only via editing usb-moded configuration files. usb-moded changes these values accordingly to the INI file. This is setting for developer mode.

$ cat /etc/usb-moded/dyn-modes/developer_mode-android.ini 
[mode]
name = developer_mode
module = none
network = 1
network_interface = rndis0

[options]
sysfs_path = /sys/class/android_usb/android0/functions
sysfs_value = rndis
sysfs_reset_value = none
softconnect_path = /sys/class/android_usb/android0/enable
softconnect = 1
softconnec_disconnect = 0
idProduct = 0A02

To enable diagnostic mode, you can append diag into sysfs_value and extra lines like this (you must be root to edit INI files):

$ cat /etc/usb-moded/dyn-modes/developer_mode-android.ini 
[mode]
name = developer_mode
module = none
network = 1
network_interface = rndis0

[options]
sysfs_path = /sys/class/android_usb/android0/functions
sysfs_value = rndis,diag
sysfs_reset_value = none
softconnect_path = /sys/class/android_usb/android0/enable
softconnect = 1
softconnec_disconnect = 0
idProduct = 0A02
android_extra_sysfs_path = /sys/class/android_usb/android0/f_diag/clients
android_extra_sysfs_value = diag

You need to restart phone or “systemctl restart usb-moded.service” to take the effect. When the file is modified, selecting developer mode on USB connection also activates diagnostics interface on USB. On Windows system there is no driver available for newly added diagnostics port. You can use driver from other Qualcomm-based devices, but the device name should include “diagnostics port”. I used driver from LTE USB stick.

If device is normally detected, you can now use Qualcomm tools to poke Jolla’s radio. Be careful not to brick this part! They are independent from OS!

When there are problems in USB usage, restore the values to original. Back up your system before potentially dangerous operations!