Enable Nexus 4 DIAG Mode for QPST

lyriquidperfection

Inactive Recognized Developer
Jun 14, 2009
2,571
2,969
0
Nottingham
Okay here is how you enable DIAG Mode on the Nexus 4:

su -c 'setprop usb.sys.config diag,adb'

And to restore MTP Mode:

su -c 'setprop usb.sys.config mtp,adb'

Note: You must be rooted in order to issue the above commands.

Now for the hard part. Although enabling DIAG Mode is easy, finding the Qualcomm diagnostic drivers for this device on the other hand is not and without these we cannot do much more.

If anyone can get these drivers or has the knowledge to patch Samsung's drivers to enable the Diagnostic Serial Port then please get in touch.

Sent from my Nexus 4 using Tapatalk 2
 

Kaffeekranz

Senior Member
Dec 29, 2010
240
127
0
My first guess for obtaining the drivers would be LG.
I hopped on their site, looked for the OG resources and downloaded them; they do include generic diag drivers.
I thought I'd just try and see if they worked for a N4 in diag mode, but your command did nothing as far as I could see on a non-stock ROM.
The Nexus still shows up with MTP access, and enumerates with the same VID and PID, with and without USB debugging enabled that is.

Next step would probably be having a look at the Optimus G's driver entries and changing them to the N4's, if we could see what the N4 enumerates with.

If that makes sense to any of you.
Good old Motorola days, weeks spent sifting through their OMAP bootrom drivers.
 

lyriquidperfection

Inactive Recognized Developer
Jun 14, 2009
2,571
2,969
0
Nottingham
  • Like
Reactions: ferickstrom

Kaffeekranz

Senior Member
Dec 29, 2010
240
127
0
Well here is a link to the USB initialisation rc script source code:

https://android.googlesource.com/de...974430a67da4878c61de0970b56f/init.mako.usb.rc

Here we can see exactly what gets changed when setting property sys.usb.config to diag,adb.

As you can also see we also have the ID and vendor info to modify another devices driver with.

Let the games begin!

Sent from my Nexus 4 using Tapatalk 2
Without changing anything in LG's drivers it already recognized LGE AndroidNet For Diagnostics Port (COM3) and AndroidNet USB Serial Port (COM4), but it got stuck on a CDC serial driver.
And right when I'm typing this and downloading QPST the phone reboots.
But you should have a go at LG's drivers, they already seem to work partly.. I'm going to put it in diag mode again and see how QPST responds.

Yup, both ports are basically recognized, though I'm lacking knowledge of QPST.


I'm guessing the first one is the modem?
The read out on it works flawlessly (after figuring out that an unlocked phone probably has no MSL/SCP) with a QPST version you uploaded last year (what a coincidence!), but I can't connect to the QC apq8064 and I don't know whether I'm even supposed to. But a newer QPST version would be worth a shot.
But like I said, I'm seriously in over my head.
 
Last edited:
  • Like
Reactions: ferickstrom

frescoraja

Senior Member
May 30, 2011
559
319
0
Brooklyn, NY
Would this allow us to unbrick a nexus 4? Or perhaps unlock radio bandwidths for use on LTE networks ? I am not familiar with qpst I think I used it once to flash a droid to cricket.
 

lyriquidperfection

Inactive Recognized Developer
Jun 14, 2009
2,571
2,969
0
Nottingham
Without changing anything in LG's drivers it already recognized LGE AndroidNet For Diagnostics Port (COM3) and AndroidNet USB Serial Port (COM4), but it got stuck on a CDC serial driver.
And right when I'm typing this and downloading QPST the phone reboots.
But you should have a go at LG's drivers, they already seem to work partly.. I'm going to put it in diag mode again and see how QPST responds.

Yup, both ports are basically recognized, though I'm lacking knowledge of QPST.


I'm guessing the first one is the modem?
The read out on it works flawlessly (after figuring out that an unlocked phone probably has no MSL/SCP) with a QPST version you uploaded last year (what a coincidence!), but I can't connect to the QC apq8064 and I don't know whether I'm even supposed to. But a newer QPST version would be worth a shot.
But like I said, I'm seriously in over my head.
OK I installed the LG Drivers but still a no go for me. Can you have a look in your device manager and tell me what driver name goes with each PID & VID.

Thanks in advance.

Sent from my Nexus 4 using Tapatalk 2
 

lyriquidperfection

Inactive Recognized Developer
Jun 14, 2009
2,571
2,969
0
Nottingham
Isn't qpst for cdma phones? I've never used it on a GSM phone, only sprint and cricket phones.
Not necessarily. Advanced functions maybe but I used QPST on my Samsung SGS3 LTE I9305 which was GSM but as it used a Qualcomm Modem I was able to backup and restore nv items in diag mode.

This is what I am trying to achieve with the Nexus 4.

I also think having access to the nv area will allow us to tinker with other things.

Sent from my Nexus 4 using Tapatalk 2
 

Kaffeekranz

Senior Member
Dec 29, 2010
240
127
0
OK I installed the LG Drivers but still a no go for me. Can you have a look in your device manager and tell me what driver name goes with each PID & VID.

Thanks in advance.

Sent from my Nexus 4 using Tapatalk 2
Does it even pick up on the additional devices?
It was pretty straight forward for me, besides getting into diag.
I first enabled USB debugging, then terminal

su
setprop sys.usb.config diag,adb

Afterwards I connected the phone and my Win7 x64 PC already started installing the LG diag drivers.
But I'll have a looksie what drivers and VID/PID it uses specifically when I'm back home tonight.

(And I deleted the standard N4 ADB drivers first, but I doubt that made a difference)
 
Last edited:

lyriquidperfection

Inactive Recognized Developer
Jun 14, 2009
2,571
2,969
0
Nottingham
What's the goal with the diag mode here? lg uses lgnpst for their phones, and we have a thread on here somewhere that has stock roms in that format, if anyone wants to try it out. You can get your nexus in download mode(vol buttons combo) and potentially revive a bricked device.

Edit: here's the thread. http://forum.xda-developers.com/showthread.php?t=1976057
Thanks for the info. I have already been looking into this however as QPST is specifically for Qualcomm chipsets you can potentially do alot more with it. LG's Tool is quite restricted in many respects.

Sent from my Nexus 4 using Tapatalk 2
 

RussianBear

Recognized Contributor
Nov 10, 2008
1,978
311
83
Thanks for the info. I have already been looking into this however as QPST is specifically for Qualcomm chipsets you can potentially do alot more with it. LG's Tool is quite restricted in many respects.

Sent from my Nexus 4 using Tapatalk 2
What are you trying to accomplish? I could point you towards a few very good threads on here. Different chipsets, but goes deep into some Qualcomm stuff.
 

lyriquidperfection

Inactive Recognized Developer
Jun 14, 2009
2,571
2,969
0
Nottingham
What are you trying to accomplish? I could point you towards a few very good threads on here. Different chipsets, but goes deep into some Qualcomm stuff.
Mainly backing up and restoring of all nv items etc. I have a program I made that can communicate with Qualcomm chipsets which allows IMEI repair etc so im really looking to make Nexus 4 work correctly with it then I will release to the masses for testing etc.

Sent from my Nexus 4 using Tapatalk 2
 
  • Like
Reactions: ata1918

freddysam

Senior Member
Nov 18, 2009
135
75
0
Yes I have it working and can backup nv in QPST but restore always fails at 9 percent.

To get device recognised in diag mode you must install the latest LG United USB drivers then place phone in diag mode as per the first post.

Sent from my Nexus 4 using Tapatalk 2
I have found that restoring certain nv values causes errors on some phones. I think it is a protection system. If you an figure out where exactly it is failing, you might have success skipping over the trouble nv values.