Showing posts with label Android. Show all posts
Showing posts with label Android. Show all posts

Sunday, 17 April 2016

Android Phone Not Connecting via DHCP

I had a weird problem where suddenly my phone stopped connecting to my home WiFi. I was getting the WiFi icon with the exclamation mark, meaning that the router was connecting but I wasn't getting all the info needed to participate in the network.

(The solution further down doesn't require you to understand the next couple of paragraphs, so don't despair if there's too much tech talk in what follows.)

Many posts on-line suggested using a static connection. I was able to do that at home, because I knew the range of DHCP addresses that my router would not give out. But I wasn't satisfied with that solution. I hate it when problems mysteriously arise, and I couldn't identify any reason why my network connection at home should have suddenly started failing.

About the third time I looked for a solution, I came across this document from Princeton. It mentions that there's a bug in some Broadcomm chips that messes up DHCP when the network stays on when the device is asleep.

Well, I remember noting that I had my network configured to stay up when the device was asleep. I noticed it because I didn't think I had configured it that way. (I sometimes find my phone on the settings screen when I pull it out of my pocket, and settings are accidentally changed.)

So (here's the solution), I went back to Settings-> WiFi, then touched the three dots near the top right of the screen, then Advanced, then I turned off "Keep Wi-Fi on during sleep", which set my network to go off when the device sleeps. After that, my phone connected to my home network just fine.

My phone is a Nexus 4, running Android 5.1.1, but obviously this might affect other models since it looks like it's because of the hardware.

Sunday, 22 July 2012

Upgrading Android Phone With Linux

I've had a Samsung Galaxy S II with Android 2.3.3 from Virgin Mobility in Canada since last year at this time. Part of the reason I went Android is I wanted to get away from having to have a Windows VM just to manage my phone. When I got the Galaxy I asked how upgrades worked, and I was told it was a stand-alone upgrade.

Time goes by and I rather enjoy not having my phone's behaviour change every time I plug it in to my computer. For that matter, I enjoy not having to plug it into a computer all the time. Lately, however, some of the things that I didn't like about my phone bugged me enough that I thought I should do something about them. And before doing that, I thought, well I better upgrade Android first.

So it turns out I needed a PC or a Mac to upgrade using the Samsung Kies software. No stand-alone upgrade like they told me. Crap. Well, I thought, I'm a Linux user so suck it up and Google for the solution. Many Androids do indeed have a stand-alone upgrade on the phone, and people report it works quite well, although it's best to be connected to WiFi first. I suspect, therefore, that either it's something that Virgin/Bell did to their version of Android, or it's an artefact of the old version of Android.

In other words, these instructions are only for if you can't find the stand-alone upgrade on your phone. Look under Settings-> About Phone.

Without the stand-alone upgrade, here's what I did:
  1. I went to samfirmware.com to find the version of software for my exact model of phone, a GT-I9100M and download it. The version I got was 4.0.3 (Ice Cream Sandwich)
  2. I uncompressed it
  3. Heimdall is the Linux program to flash the Samsung's firmware. I downloaded heimdall 1.3.1, both frontend and the base, from the heimdall github site. At the time I wrote this, heimdall 1.3.2 was the most recent, but apparently it had an issue and the Internet recommended using 1.3.1
  4. I installed each of the .deb files by double-clicking on them
  5. I ran "sudo heimdall-frontend" in a terminal. I had to run it with sudo or I would get a "libusb error: -3" [Update: On another system I got "heimdall-frontend: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory" when I installed the 32-bit Heimdall on a 64-bit Linux Mint.]
  6. Somewhere around here you may want to back up your phone. I didn't, but I was quite confident that most of what I have on the phone is also in the cloud somewhere. I copied all my photos to my computer before starting the upgrade
  7. The phone has to be in "download mode" before connecting to it with heimdall. To put it in download mode, turn off the phone, disconnect the USB cable, and hold down Volume-Down, Power, and Home all at the same time for a few seconds. The phone shows a display that it's in download mode within a couple of seconds. To quit without downloading anything, just hold down the power button for five seconds or so (http://forum.xda-developers.com/wiki/Samsung_Galaxy_S_II_Series#Download_Mode)
  8. I prepared the firmware to flash according to the Heimdall instructions: https://github.com/Benjamin-Dobell/Heimdall/tree/master/Linux, under the heading "Performing a Custom Flash with Heimdall Frontend". Note that the instructions say to get the PIT file from the phone first
It took a couple of minutes to download all the files. For the larger files the feedback would pause every once in a while. I was patient and waited and it continued after a brief pause.

Once it's done the phone rebooted and set about doing a bunch of post-install updating. It took maybe ten minutes tops and the phone was ready to go. My memos were still there.  I lost all my playlists. As far as I can tell, that's all I lost (but then I don't have a lot of stuff on my phone that isn't in the cloud).

Finally, an annoying irony: One of the first things I noticed when I started to use the new version is that it does indeed support a stand-alone upgrade, so now all I need to do is connect to WiFi and upgrade.