Category Archives: Mobile

Everything that pertains to mobile phones, PDA’s laptops and other mobile equipment..

Flashing modems/baseband for SGS4 and OnePlus One from Linux/MacOSX

After a while of having “one the edge” releases of CyanogenMod on both my and my wife’s phones our phones started… acting up. So common suggestion was to bum baseband release as it is most likely not providing functions required by newer OS. So I set out to do so with some stumbling along the way.

Get the modem (extracted from full firmware – waste of bandwidth, but I don’t care for stock OS) for SGS4:

$ sudo heimdall flash  --MDM modem.bin --no-reboot

ran above code several times, manually rebooting right back into download mode (VolDown+Home+Pwr) and eventually it stuck with the phone (do it “not enough” times and you’ll get phone in it’s original state).

Note: heimdall print-pit was instrumental in figuring out the --MDM option as it listed proper partition.

For OnePlus One things were kind of simpler: downloaded flashable zip with modem in it, and flashed it via TWRP. Doing the same from CLI with fastboot for some reason was not doing anything.

Proper CWM flashing with fastboot

I got bitten more than once with device rooting recently with My Samsung Galaxy S4 and Nexus 7 (2013) and Nexus 10. The latter made me think that something is amiss and my recovery mode was botched. So I went looking just to stumble upon:

fastboot erase recovery
fastboot erase system -w
fastboot erase boot
# Download latest twrp/cwm recovery
# Check md5sum
fastboot flash recovery nameofrecovery.img

Android, adb and “no permission”

I’ve got tired of seeing:

$ adb devicesList of devices attached 
???????????? no permissions

So I had to dig a bit. Combining StackOverflow article and official docs I arrived at somewhat simple solution that avoids overly enthusiastic suggestion of making device “anybody-writable” and made things “just right” for myself (fixing old-school Udev rules sytax along the way):

  1. plug-in your device and using lsusb locate attributes like iVendor and iProduct (I just went with iVendor…)
  2. add /etc/udev/rules.d/51-android.rules :
    SUBSYSTEM=="usb",ATTR{idVendor}=="18d1",MODE="0660",GROUP="users"
  3. restart udev:
    udevadm control --reload-rules

End result: my any of my Nexus7 devices whenever attached will be owned by users group (which includes me and my family) with adb now properly responding:

$ adb devices
List of devices attached 
07bdc25b        unauthorized

which only means I have tap OK on N7 upon connect to allow adb debugging from this PC.

Neat trick I’ve spotted is that you can poke some of the rules without re-plug via:

udevadm trigger --attr-match=vendor='Yoyodyne' --attr-match=model='Frobnicator 300'

Didn’t have to use it this time – but may come handy next time.