Sunday, September 16, 2012

Getting Heimdall to work with the SGH-T989

Apparently the version of the Samsung Galaxy S II used by T-Mobile is closely related to the Samsung Galaxy Tab 10.1, because I was able to use a forked version of Heimdall (the open-source Linux equivalent of the closed-source, binary-only, leaked-from-Samsung Odin) designed for the Galaxy Tab to get a copy of ClockWorkMod Touch Recovery loaded onto my phone.

The regular version of Heimdall (1.3.2 as of this writing) doesn't work with the T-Mobile SGSII (also known by the model number SGH-T989), but there is a bug report on the main Heimdall project's GitHub site which points at a forked version that will work if you massage it properly.

Within the forked version is a piece of code that checks a numeric device type ID. A few IDs are already allowed, but the program will bail on you if the device isn't in the list. Well, the SGH-T989 comes up as a number "30", which wasn't on the list. Here's a patch to fix it (assuming Blogger doesn't mangle things):

diff --git a/heimdall/source/BridgeManager.cpp b/heimdall/source/BridgeManager.cpp
index 1faa626..7359a0d 100644
--- a/heimdall/source/BridgeManager.cpp
+++ b/heimdall/source/BridgeManager.cpp
@@ -1621,10 +1621,15 @@ bool BridgeManager::BeginSession(void)

int deviceType = setupSessionResponse.GetUnknown();

- // TODO: Work out what this value is... it has been either 180 or 0 for Galaxy S phones, 3 on the Galaxy Tab, 190 for SHW-M110S.
- if (deviceType != 180 && deviceType != 0 && deviceType != 3 && deviceType != 190)
+ /* TODO: Work out what this value is...
+ * it has been either 180 or 0 for Galaxy S phones,
+ * 3 on the Galaxy Tab,
+ * 30 on T-Mobile Galaxy S II (SGH-T989),
+ * 190 for SHW-M110S. */
+ if (deviceType != 180 && deviceType != 0 && deviceType != 3 && deviceType != 30 && deviceType != 190)
- Interface::PrintError("Unexpected device info response!\nExpected: 180, 0 or 3\nReceived:%d\n", deviceType);
+ Interface::PrintError("Unexpected device info response!\nExpected: 180, 0, 3, 30, or 190\nReceived:%d\n", deviceType);
return (false);

You really only need to add "&& deviceType != 30" into the right spot.

So, the basic basics:

  1. Download the forked version of Heimdall with "git clone git://"
  2. Compile and install Heimdall:
    1. Enter the new "Heimdall" directory with "cd Heimdall"
    2. Read through the various README files, including the "Linux/README" one.
    3. Change into the "libpit" directory and run "./configure && make", then exit the directory upon success.
    4. Change into the "heimdall" directory and run "./configure && make". Upon a successful compile, run "sudo make install", then exit the directory.
    5. Change into the "heimdall-frontend" directory and run "qmake && make". Upon a successful compile, run "sudo make install", then exit the directory.
  3. Download a ClockWorkMod Touch Recovery image by visiting the ClockWorkMod ROM Manager site and finding the "Samsung T-Mobile Galaxy S2". Click on the download link in the second column ("" as of this writing). For me, this saved as "recovery-clockwork-touch-"
  4. Reboot your phone into Download Mode with the following procedure:
    1. Plug the USB cable into your phone if it isn't already connected.
    2. Press and hold down both volume keys, followed by holding down the power button. Keep holding down the power button until the phone reboots (a brief vibration happens)
    3. Release the power button but keep holding down the volume buttons (it's okay if you accidentally release the volume buttons momentarily)
    4. The phone will come up, and you can release the buttons.
    5. There will be a prompt saying you're about to enter Download Mode. Press the Volume Up button once to continue.
    6. At this point, you should be in "Odin Mode". (Note that there's a big warning not to reboot the phone when it's in this mode -- as far as I know, it's okay to reboot here unless you're actually transferring data. But, the phone will restart itself after a few minutes if it isn't told to do anything.)
  5. Now, go back to the command line on your Linux box, and run the command "heimdall detect" just to see if the phone is communicating with the computer.
  6. Note: Ideally, there would be a step here where we would dump the recovery image from the phone to make a backup, but apparently that isn't working. The phone is structured in a way that even a screwed up recovery image shouldn't cause insurmountable problems (it shouldn't affect the Download Mode, for instance), but if you're wary, don't proceed.
  7. Upload the recovery image by running "heimdall flash --recovery recovery-clockwork-touch-". It should only take a few seconds, and the phone should reboot.
  8. To test the recovery image, you can either follow the same steps as outlined in step 4, but with the USB cable removed, or run the command "adb reboot recovery" from the Android SDK with the USB cable plugged in.

Thursday, May 10, 2012

Political irrelevance

There's exactly zero chance I'll vote for Mitt Romney this year, though I think there are criticisms of him floating around which are completely irrelevant. I tend to like MSNBC, though some of the hosts tend to rag on their opposition a bit too much in my opinion. I'm not a confrontational person, though.

Anyway, I like Rachel Maddow and Chris Hayes more than Ed Schultz or Lawrence O'Donnell because the former pair tends to be more accepting of outside positions. However, tonight Rachel Maddow went on at length about the Washington Post story about Mitt Romney's bullying of a (presumed) gay and nonconformist student at boarding school.

Now, clearly this bullying was wrong, but teenage years are often about stepping up to and beyond the line of what's reasonable in order for a person to form their moral sense. Many of the students who saw it or were involved now express regret, and that's more or less exactly how things should go. It's very unfortunate that someone was victimized in the process, but clearly it had a lasting effect. Presumably many of the aggressors acted with greater restraint in subsequent periods of their lives.

Bullying has gotten a lot of well-deserved attention these days, and it should be stamped out to the extent possible, but it's going too far to say that there should be absolutely zero tolerance. The ideal is probably to catch bullying early so that it doesn't get out of hand—Avoiding the escalation that could result in permanent damage.

According to at least one of Romney's classmates, there actually was an expectation that the students would be punished for their actions, but it ended up not happening for whatever reason. Inasmuch as Romney and his cohorts were responsible for their actions with their hormone-addled teenage brains, a certain level of responsibility also falls to the faculty and staff of Cranbrook.

Now, there does seem to be a fair amount of mess to be found if Romney does not distance himself from his teenage indiscretions appropriately. Everyone makes mistakes in their adolescent years, so the script is not hard to put together.

The other thing that has bugged me is the criticism that Romney and his wife own a whopping four cars at their bi-coastal residences. My mind reeled as even Jay Leno joked about it (remember, he owns dozens automobiles, many or most of which are completely impractical).  Considering the immense wealth of the Romney family, you'd practically expect them to own a fleet of 40 cars rather than 4.  My own family owned 4 cars for a brief period while I was in college and my brother wasn't far behind.  Granted, at least two of the cars were beaters, but our family was probably 100 times less wealthy than the Romneys at the time.

Anyway, let's forego the juvenile and usual things and get on to more interesting stuff.