Tuesday, December 22, 2009

Replacing power-steering vacuum suction hose on 2001 Honda Civic

On a non-computer note, I had the misfortune of not replacing the power-steering reservoir in its bracket after changing the left headlight on my civic. The hose connecting it to the power-steering pump rubber one of the belts, eventually puncturing the hose. The fluid ran out of the system and my steering started making unhappy noises. Then followed seven hours of me figuring out how to fix this on a Sunday when shops were closed. The upshot was that I learned that the name of the hose is the power-steering suction hose, and it is a part available only at the dealer (costs < $5). It is a curved, molded tube about a foot long. It looks a bit like a question mark. It is distinct from the high-pressure hose and the return hose. Here are the steps I took to replace it (after my temporary hack of duck-tape and epoxy):

  1. Turn off engine
  2. Suck as much fluid as you can out of the power-steering reservoir with a turkey baster (literally) or some other such device. I used a turkey baster with a straw on the end to reach a bit further in. Deposit this fluid in a container that you can bring to an auto parts shop for proper disposal.
  3. Take a pair of pliers, grab the spring-clamp attaching the suction tube to the reservoir and lower the clamp down the tube so it is no longer clamping the tube onto the reservoir.
  4. Place a receptacle underneath the hose and reservoir to catch any fluid that spills out when you remove the hose from the reservoir. I used a disposable plastic cup.
  5. Remove the hose from the reservoir. It comes off moderately easily. A fair bit of fluid will drain out of the reservoir.
  6. Place reservoir on a towel or something to catch any remaining drips.
  7. Empty plastic cup
  8. Repeat procedure for other end of hose. Less fluid will spill out this time, but it may spill on the alternator, which probably is not good.
  9. Remove hose from car, remove clamps from hose, and slide clamps onto replacement hose.
  10. Reverse detachment procedure to reattach hose to pump and reservoir and move clamps back into place clamping the hose at each end.
  11. Place reservoir back into holding bracket.
  12. Fill up reservoir to min fill line with honda-compatible power steering fluid.
  13. Start engine and turn off after a few seconds. The fluid level in the reservoir will have dropped a bunch.
  14. Add more fluid to reservoir to bring it back up to somewhere between min and max level.
  15. Start engine and turn steering wheel stop to stop a few times. Don't hold at a stop too long - this strains the pump. The purpose of turning wheel a lot is to work out any air bubbles from the system. I could not tell if this was effective.
  16. Evaluate fluid level with engine off.

Wednesday, November 25, 2009

Tether via USB from Android G1 to Ubuntu

I installed Cyanogen's mod version 4.2.5 on my Android G1 phone, and it's been working great. On feature that was added since version 4.2.3 is USB networking. Turns out it's simple to use with Ubuntu 9.10 (Karmic). It may work with earlier version as well. The steps:
  1. Check the box for 'Internet tethering' under Settings->Wireless controls
  2. Plug G1 into Ubuntu box with USB cable. Btw, looks like the order of these first two steps doesn't matter.
  3. Click on the networking icon in your toolbar on the Ubuntu box. In the menu that appears, I have an item entitled 'Wired Network (HTC Android Phone)'. Underneath it is a choice 'ifupdown (bnep0)'.
  4. Click on 'ifupdown (bnep0)'.
  5. Now you should be connected to internet.

So this is pretty straightforward, and in particular, it doesn't seem that the Android application, Wired Tether for Root Users, is necessary.

Monday, October 5, 2009

Howto transfer photos from Android G1 to computer via USB

I'm not sure why it was so hard to to figure this one out. I wanted to transfer photos from my Android G1 to my linux laptop. Basically, you follow the following steps, many of which are from, http://forums.t-mobile.com/tmbl/board/message?board.id=AndroidFAQs&message.id=74:

  1. Plug in USB cable to connect the phone and laptop
  2. On the phone, go the notifications (drag down the top of the screen). There should be a 'USB connected' notification. Click on it.
  3. Click on 'Mount'
  4. On my Ubuntu desktop, under 'Places', a new option now shows up titled '1.0 GB Media'. That is the connection to the Android phone.
  5. For me, the option to open 'F-Spot' photo tool popped up. I declined and used the built in file browser. In either case, the photos are located in the folder dcim/Camera.
  6. When finished manipulating the files, unmount the volume:
    1. Go to Places -> '1.0 GB Media' and opening up the file browser
    2. Go to File and select 'Unmount Volume'
    3. On the phone, go to the notifications pull down again and click on 'Turn off USB storage' and click on 'Turn Off'

  7. Unplug USB cable from phone and computer.

Sunday, June 14, 2009

Jaunty and 2.6.30 kernel with Nvidia drivers

I recently upgraded to 2.6.30 on my Jaunty laptop and desktop. Turns out there are some issues with the nvidia drivers that come with Jaunty and the newer 2.6.30 kernel. The following upgrade process worked for me (based on the solution found at https://bugs.launchpad.net/ubuntu/+source/nvidia-common/+bug/384639/comments/8):
  1. If you have Nvidia drivers then:
    1. Go to some temp directory (~/tmp for me)
    2. wget -c http://archive.ubuntu.com/ubuntu/pool/restricted/n/nvidia-graphics-drivers-180/nvidia-180-kernel-source_180.60-0ubuntu1_i386.deb http://archive.ubuntu.com/ubuntu/pool/restricted/n/nvidia-graphics-drivers-180/nvidia-180-libvdpau_180.60-0ubuntu1_i386.deb http://archive.ubuntu.com/ubuntu/pool/restricted/n/nvidia-graphics-drivers-180/nvidia-glx-180_180.60-0ubuntu1_i386.deb

    3. sudo dpkg -i nvidia-180-kernel-source_180.60-0ubuntu1_i386.deb nvidia-180-libvdpau_180.60-0ubuntu1_i386.deb nvidia-glx-180_180.60-0ubuntu1_i386.deb

  2. wget -c http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.30/linux-headers-2.6.30-020630-generic_2.6.30-020630_i386.deb http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.30/linux-headers-2.6.30-020630_2.6.30-020630_all.deb http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.30/linux-image-2.6.30-020630-generic_2.6.30-020630_i386.deb

  3. sudo dpkg -i linux-headers-2.6.30-020630-generic_2.6.30-020630_i386.deb linux-headers-2.6.30-020630_2.6.30-020630_all.deb linux-image-2.6.30-020630-generic_2.6.30-020630_i386.deb

Monday, May 25, 2009

[product-research] wireless headset for pc and cell

I'm going to experiment with keeping notes on various product research expeditions I go on to see if it's useful to others (or myself). This is the first one.

Goal: I want a wireless stereo headset and microphone with good audio quality and long range that I can wear around the house. Bluetooth isn't sufficient because of range. The idea is that I can leave my cell phone and computer in my bedroom and wander around the house while on a cell call or VOIP call. I was hoping that this headset would seamlessly work with my cellphone and computer and also have good enough quality that it could be used for music as well as voice. It'd also be great if I could end calls from the headset.

Result: I couldn't find any product that quite does this, but 100m Class-1 bluetooth comes darn close. All I need is a headset that has decent audio quality, and perhaps a repeater so my class-2 cellphone can get decent range. Here are some options I'm considering:

  1. Callpod Dragon looks pretty darn close. Class-1 Bluetooth (extended range), simultaneously can connect to PC and phone. For max range, the PC and phone have to have Class-1 bluetooth connectivity.

  2. Creative labs HS-1200. 72 foot range, RF, USB, good audio quality. Range maybe insufficient and not sure how it would hook up to cell phone.
  3. Plantronics CS361N. 300 foot range, RF, analog RJ-9 connector. no audio quality documented. Could buy RJ-9 to 2.5mm connector.

Some other options I was toying with:

Android G1 Cupcake hacking links/summary

I have the G1 dev phone, but with the recent cupcake update, it got reverted to T-Mobile's stock OS. In particular I lost root on the phone. I ended up installing the JesusFreke OS on the phone, which is working well. Here's what I figured out along the way.

There are a few important concepts in G1 modding (please correct me where I'm wrong):
  • SPL: The Secondary-Program-Loader is a piece of firmware that is basically the bootloader - it loads the OS. You want to replace this with a more fully functional version. I use the HardSPL loader. This loader, as well as some of the other ones out there, gives you the option to use fastboot (here or here), which lets you install on partitions on the phone and boot.
  • Recovery partition: There is a partition on the phone that has a kernel that is used only when the phone is booted into recovery mode (turn on holding power and home at the same time, then press alt+l to get to the menu). Installing a custom image here, like JFv1.43_Recovery.zip from android-roms, gives you an extra option in the recovery menu to use nandroid to backup your entire system (not sure if it includes the sdcard). Usefull if you want to fiddle with your firmware or wiping your phone and want to be able to restore.
  • System ROM: This is the system that runs during normal booting and operation. I replaced this with JesusFreke JFv1.51_CRB43-ADP.zip using instructions here. It gives you a kernel set up for wifi-tether, and also includes a couple of extra neat things like the ability to multi-touch pinch zoom in and out on the browser. If you're just interested in wifi-teher, you probably don't need JesusFreke's ROM. The wifi-tether link has an alternate kernel that is a smaller mod. Note that installing the JesusFreke ROM recommends wiping the data on the phone.

Android-roms at http://code.google.com/p/android-roms/ is a useful site that pulls together most of this info. JesusFreke's blog has details on each ROM release and what was changed from the stock ROM.

Finally, if you have an android dev phone and lost root with the cupcake update. The directions at http://forum.xda-developers.com/showthread.php?t=518251 worked for me to regain it. I think these directions require the custom SPL, such as HardSPL.

Sunday, February 1, 2009

Ubuntu Intrepid, Skype, and Alsa Settings

I finally figured out the magic incantations to get skype working with Ubuntu Intrepid 8.10 and pulseaudio, at least on my hardware. I have 82801I (ICH9 Family) HD Audio Controller according to lshw and lspci. I have a microphone connected to the front mic input. The key was to ensure the alsa settings were correct. Here were the steps:

  1. Configure alsa using alsamixer, part of the Ubuntu alsa-utils package. I think there are also gui interfaces to do this. Here are some notes on settings:

    • In the 'recording' section (navigate with TAB), there are settings for both capture and capture 1. The key for me was to set capture to front mic. I think this has changed from Hardy. In Hardy, I had to set capture 1 to front mic. For good measure I set both to front mic.
    • The mic and mic boost settings didn't seem to affect anything on my system.
    • The front mic settings in 'playback' section apply to monitoring the mic input. A good initial sanity check is to bump up the front mic settings and make sure you hear the mic out of your speakers.

  2. Install the libasound2-plugins package. apt-cache show libasound2-plugins shows the version as 1.0.17-0ubuntu5 for me.
  3. Make sure the microphone works in pulseaudio. For this, the Ubuntu padevchooser package was handy. Run it and it adds a tray icon. I chose 'volume meter (recording)' from the drop-down menu. This basically invoked pavumeter with the right args to show the mic level that pulseaudio reads. At this point, when you tap your front mic, the vumeter window should show a bump in signal.
  4. Start skype (I think I use the one from the medibuntu repository) and go to options -> sound devices. There are three main settings:

    Sound in: pulse
    Sound out: pulse
    Ringing: pulse

    I set all to pulse, but my guess is that default is fine and defaults to pulse anyway.
    At this point the skype test call worked for me!

Thursday, January 29, 2009

Comparison of Boston, San Francisco and Seattle on weather

I'm toying with moving to Boston from SF area and nature is a big factor. Here's some data I'm looking at:

Monday, January 19, 2009

Using jgit with socks5 proxy on Ubuntu

I use jgit to store my git repositories on Amazon S3. On my laptop I also periodically connect to the internet through tetherbot, which uses a socks proxy (see earlier post for more details there). I finally figured out how to get jgit, and I suppose other java applications working with the proxy. Jgit is java based and you need to pass the right flags to java, as described at http://java.sun.com/javase/6/docs/technotes/guides/net/proxies.html. The flags are:-DsocksProxyHost=localhost -DsocksProxyPort=1080. I inserted the following code into the jgit program, before the exec .... $java_args part:
if (netstat -pl --numeric-ports 2>&1 | grep ':1080.*adb' > /dev/null); then
echo "Using Java socks5 proxy args"
java_args="$java_args -DsocksProxyHost=localhost -DsocksProxyPort=1080"

I inserted the lines using emacs. For some reason, xemacs and nano garbled the file when I tried editing it with them.

Saturday, January 17, 2009

Transparent proxy in Ubuntu

I have a socks5 proxy on my machine (actually on my Android phone, but port-forwarded through adb), and want non-socks5 aware applications to be able to use it. I tried tsocks, but couldn't get it to work with wget - it wouldn't proxy the DNS resolution, even if I set the compile time flags. I then switched to proxychains, which works great with wget and other commandline utils. The only issue is that proxychains does not seem to work with stand-alone java applications, failing in the connection library like:

Caused by: java.net.SocketException: Network is unreachable
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at java.net.Socket.connect(Socket.java:469)
at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
at sun.net.www.http.HttpClient.(HttpClient.java:233)
at sun.net.www.http.HttpClient.New(HttpClient.java:306)
at sun.net.www.http.HttpClient.New(HttpClient.java:323)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:837)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:816)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:703)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1026)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:373)

Update: got this working with shell-wrapped jar files. See next post

options for git on Amazon S3

Here's the options for backing up git on S3 as I see them now:

  • jgit - standalone java app that does git fetch and push to S3. I currently use this one, but it doesn't work with transparent proxy apps such as proxychains. Occasionally I use an old laptop with no wifi or bluetooth, and so want to use a USB-tethered Android G1 for internet access.
  • S3-backed Filesystems

  • gits3 - a git implementation that can push to s3. Pretty new. Is it stable yet?

I'm tempted to try the filesystem options, but I'm concerned about reliability and transparency (I want more visibility into how the S3 ops are going).

Friday, January 2, 2009

Store git repository on Amazon S3

I keep my home dir and some other dirs in a few git repositories. I used to back them up to slicehost, which I've been very happy with. Since S3 has much lower storage charges, I modified my scripts to backup the repositories to S3 as well using jgit from here. Figure I'll play around with it and see if the repositories get out of sync.

Bluetooth tethering from Ubuntu to Android G1

Update: Looks like this does not work with the new Cupcake OS :(

Yeah! I finally got this working. I got my Thinkpad T500 running Ubuntu Intrepid to connect via bluetooth to my Android G1. So the laptop connects to the internet through whatever internet connection the phone has (Edge, 3G, or Wifi). I'm writing this at a starbucks on my laptop, connected through my G1 to a TMobile hotspot (install the hotspot app on your G1 and reboot the phone. You'll see a bullseye in the notification bar when you wifi connect to the hotspot on the phone) Roughly the steps I did to tether were:

  1. Get 'adb' installed from the Android dev tools. I downloaded the whole sdk.
  2. The main starting point is the blog entry at: http://www.gotontheinter.net/content/second-g1-story-proper-bluetooth-tethering-how-short
  3. From there I got the files pand, iptables and bnep.ko and copy to /data/local/bin/, creating the dir if necessary.
  4. Get busybox from http://benno.id.au/blog/2007/11/14/android-busybox and install in /data/busybox (it looks like the directory is hard-coded in that binary somewhere)
  5. I did a bit of shell code to move to a subdirectory any binaries in busybox for which another version existed outside of busybox, except for ps. I figured I trust the android ones more, but Android's ps was missing the all important 'w' option
  6. Generate a file called /data/local/bin/tether.sh on the phone with the following contents:
    # first copy all files to /data/local/bin

    if ! `echo $PATH | /data/busybox/grep /data/busybox > /dev/null`; then
    export PATH=/data/busybox:$PATH

    if [ -e $pand_pidfile ]; then
    PAND_PID=`cat $pand_pidfile`
    if [ "x" = "x$PAND_PID" ]; then
    if ! (ps | grep /data/local/bin/pand | grep -v grep > /dev/null); then


    case "$1" in
    if ! lsmod | grep bnep > /dev/null; then
    echo "Adding bnep kernel module"
    insmod /data/local/bin/bnep.ko || exit
    if [ 0 -eq $PAND_PID ]; then
    echo "Starting pand"
    rm $pand_pidfile > /dev/null 2>&1
    rm $logfile > /dev/null 2>&1 # if it exists
    /data/local/bin/pand --listen --role NAP --devup /data/local/bin/blue-up.sh --devdown /data/local/bin/blue-down.sh --pidfile $pand_pidfile || exit
    echo "Success"
    if [ 0 -ne $PAND_PID ]; then
    echo "Killing pand at pid $PAND_PID"
    /data/local/bin/pand -K || exit
    kill $PAND_PID || exit
    rm $pand_pidfile > /dev/null 2>&1 # Looks like pand may have removed it for us
    sleep 1
    if lsmod | grep bnep > /dev/null; then
    echo "Removing bnep module"
    rmmod bnep || exit
    echo "Success"
    echo "Usage: /data/local/bin/tether.sh {start|stop}"
    exit 1
    exit 0

  7. Then put the following into /data/local/bin/blue-up.sh:

    # blue-up.sh
    ifconfig bnep0 netmask up
    /data/local/bin/iptables -F
    /data/local/bin/iptables -t nat -F
    /data/local/bin/iptables -t nat -A POSTROUTING -s -j MASQUERADE
    /data/local/bin/iptables -t nat -A POSTROUTING -j ACCEPT
    echo 1 > /proc/sys/net/ipv4/ip_forward
    /data/busybox/udhcpd /data/local/bin/udhcpd.conf
    echo "Interface up " >> /data/local/bin/tether-log

  8. And the following goes into /data/local/bin/blue-down.sh:

    # blue-down.sh

    if [ -e $udhcpd_pidfile ]; then
    UDHCPD_PID=`cat $udhcpd_pidfile`
    if [ "x" = "x$UDHCPD_PID" ]; then
    echo "udhcpd at pid $UDHCPD_PID" >> /data/local/bin/tether-log
    if [ 0 -ne $UDHCPD_PID ]; then
    echo "Trying to kill udhcpd at pid $UDHCPD_PID" >> /data/local/bin/tether-log
    kill -1 $UDHCPD_PID # 1 is SIGHUP
    rm $udhcpd_pidfile
    ifconfig bnep0 down
    echo 0 > /proc/sys/net/ipv4/ip_forward
    /data/local/bin/iptables -F
    /data/local/bin/iptables -F -t nat
    echo "Interface down " >> /data/local/bin/tether-log

  9. Make sure all '.sh' files and binaries in /data/local/bin have execute permissions. E.g., do:
    chmod 755 /data/local/bin/*.sh
    chmod 755 /data/local/bin/pand
    chmod 755 /data/local/bin/iptables

    I think you can alternatively set execute permissions on your laptop before you copy the files over.
  10. And the following in /data/local/bin/udhcpd.conf:
    max_leases 1
    interface bnep0
    pidfile /data/local/bin/udhcpd.pid
    option dns # Freedns dns servers
    option router
    option subnet
    option domain local
    option lease 1440 # 4 hours

  11. Next, on your laptop machine, add a line to /etc/network/interfaces to tell Ubuntu about the bnep0 interface:
    iface bnep0 inet dhcp

  12. After modifying /etc/network/interfaces, restart networking to pick up the change by executing:
    $ sudo /etc/init.d/networking restart

  13. Install the pand utility by adding bluez-compat:
    $ sudo aptitude install bluez-compat

  14. On my laptop, I have a script to start and stop things:
    case "$1" in
    if ps ax | grep sbin/NetworkManager | grep -v grep > /dev/null; then
    echo "Halting NetworkManager"
    /etc/init.d/NetworkManager stop || exit
    if ! (pand -l | grep bnep0 > /dev/null); then
    echo "Establishing bluetooth PAN connection"
    pand --connect **:**:**:**:**:** -n || exit
    if ! (pand -l | grep bnep0 > /dev/null); then
    echo "pand returned success but it looks like the connection was not made"
    exit 1
    sleep 1
    if ! (ifconfig | grep bnep0 > /dev/null); then
    echo "Bringing up interface bnep0 with dhcp"
    if cat /var/run/network/ifstate | grep bnep0; then
    echo "ifup/down thinks interface is still up. Down it first"
    ifdown bnep0
    ifup bnep0 || exit
    echo "Success"
    if (ifconfig | grep bnep0 > /dev/null); then
    echo "Taking down bnep0"
    ifdown bnep0 || exit
    pand -K || exit # MUST be run as sudo, though it does not error out otherwise.
    if ! ps ax | grep sbin/NetworkManager | grep -v grep > /dev/null; then
    echo "Restarting NetworkManager"
    /etc/init.d/NetworkManager start || exit
    echo "Success"
    echo "Usage: sudo laptop-connect-tether {start|stop}"
    exit 1
    exit 0

    Where you replace the '**:**...' with your phones hardware bluetooth address. [ Update: 'thwarted' says You can get your phone's bluetooth address in Settings | About Phone (bottom) | Status | Bluetooth Address (3rd from bottom) ]

So to use this, run /data/local/bin/tether.sh start on your phone and then run the above script on your laptop with 'start' or 'stop' as desired. Note that to start tether.sh:
  • tether.sh file must be executable (see above)
  • you need to su before running
  • You must invoke the binary with an explicit pathname, e.g. './tether.sh' or '/data/local/bin/tether.sh'. Just cd'ing into the dir and typing 'tether.sh' does not work.

If you get a not found error when invoking tether.sh and you swear it really is there and you are trying this from windows, it may be that pasting the code to a file appended '^M' to the end of each line. Consider using dos2unix to remove the extra characters.

Sorry this is a bit rough, but let me know if you find this useful or find bugs.