Sunday, October 23, 2011

Maruti Swift VXI OBD2 Connector

We have a Maruti Swift VXI which has a K series engine. Here's a photo of the OBDII connector located on the left inside of the dashboard panel under the steering wheel.

Do not yet know what all one can do with it.

Sunday, September 25, 2011

Ubuntu upgrade caused blank screen on my Acer Laptop

I have an Acer Aspire 4736 Laptop running ubuntu 10.10. I recently used update manager to upgrade to 11.04.
After upgrading and rebooting, I had a problem with the following symptoms:
  1. Acer's BIOS Splash screen showed up followed by GRUB OS selection menu.
  2. After that the laptop's screen turned purple and then blank.
  3. A few seconds later I could hear the welcome sound but the laptop screen was blank.
  4. I connected an external monitor via HDMI and the image came up on the external monitor
And so I scoured the net and came across this forum thread and realise that my laptop's LCD panel was showing an image alright but the backlight was off - confirmed this by squinting closely at my laptop's LCD panel.
I followed unknown47's advice and restarted and it worked. If you have an Acer Aspire laptop and have a similar problem, do this:
  1. Bootup ubuntu.
  2. Connect external monitor.
  3. Edit /etc/rc.local and add before exit 0:
    setpci -s 00:02.0 F4.B=00
  4. Edit /etc/default/grub and change
    GRUB_CMDLINE_LINUX_DEFAULT = "quiet splash"
    GRUB_CMDLINE_LINUX_DEFAULT = "quiet splash acpi_osi = Linux"
  5. Execute the command sudo update-grub2
  6. And restart your computer.

Getting Tata Photon+ to work on Ubuntu

So, finally got this working!!!

What I have:
  • Machine: Acer Aspire 4736
  • Operating System: ubuntu 10.10 Maverick Meerkat
  • Device: Tata Indicom Photon+ VME101 HSIA USB Modem (Manufactured by Olive vendorid:productid = 201e:2009)
And I wanted to get it to run on Linux, so here's the sequence of steps I followed.
  1. Do not plug in the modem.
  2. Open "Terminal" from "Applications>Accessories".
  3. Type the command cd /etc/usb_modeswitch.d and press enter.
  4. Type sudo gedit and press enter.
  5. Enter your ubuntu password when asked and press enter.
  6. When the text editor opens up, copy paste the following into it.
    # Haier CE 100

    DefaultVendor= 0x201e

    DefaultProduct= 0x2009

    TargetClass= 0xff




  7. Save the file as "201e:2009" (Yes that's the filename - a pair of 4 digit hexadecimal numbers seperated by colon).
  8. Close the text editor.
  9. In the terminal window, type the command sudo gedit /lib/udev/rules.d/40-usb_modeswitch.rules and press enter.
  10. Enter your ubuntu password when/if asked.
  11. Text editor will open the file "40-usb_modeswitch.rules".
  12. Browse to the end of the file till you reach the last line which says LABEL="modeswitch_rules_end"
  13. Insert a few lines by pressing enter before this last line.
  14. Insert a new entry (just like the other entries in the file above) by copying and pasting the following:
    # Tata Indicom Photon+ VME101 Olive Mobile Broadband Modem
    ATTRS{idVendor}=="201e", ATTRS{idProduct}=="2009", RUN+="usb_modeswitch '%b/%k'"
  15. Save the file.
  16. Close the text editor.
  17. Restart your computer.
  18. Plug in your modem.
  19. Wait for 15 seconds.
  20. Right click the network icon next to the clock and select "Edit Connections".
  21. Navigate to the "Mobile Broadband" tab.
  22. Click "Add Connection". Your Modem will be listed there as "Qualcomm CDMA Technologies MSM".
  23. Press "Forward".
  24. Select country as "India".
  25. Select provider as "Tata Indicom (Photon+)" and press forward.
  26. Click "Apply".
  27. In the yet open "Network Connections" window, select "Tata Indicom (Photon+)" and click the "Edit" button.
  28. In the "Username" field, type "internet".
  29. In the "Password" field, type "internet".
  30. Click "Apply".
  31. Close the "Network Connections" window.
  32. Left click the network icon next to the clock and from the menu that appears, select "Tata Indicom (Photon+)".
  33. Wait for your computer to connect to the internet and then start browsing away to glory. To disconnect, repeat step 32.
  34. Next time, you will just have to plug in your modem, wait for a few seconds for the "Tata Indicom (Photon+)" show up when you left click the network icon next to the clock and then click on it to connect again.
  • The Tata Photon+ modem has a ZeroCD feature which allows the device to act as a CDROM drive containing its own drivers and application installation files. This CDROM mode is the default mode when the device is plugged in to your USB. To use the device as a modem, we need to force it to switch modem -  a task which is achieved on Microsoft Windows by the drivers which are installed from the virtual CDROM drive. On Ubuntu, editing the "40-usb_modeswitch.rules" in steps 9 thru 15 above helps automate the task of the forcing the Tata Photon+ USB device to switch from mass storage mode (acting as a CDROM drive) to modem mode. If "40-usb_modeswitch.rules" is not edited, one would have to execute the command sudo usb_modeswitch -c /etc/usb_modeswitch.d/201e\:2009 everytime the Tata Photon+ device is plugged in.
  • Step 17 - restarting your computer: may not be necessary, but it doesn't hurt anyway.
  • Step 19 - It takes a few seconds for the modem to boot up and for the computer to force it to change modes and be recognised by the Network Manager as a modem.
  • Tata Photon+ distributed many different versions of it USB Modem devices. The above post is only applicable for the ones marked "V-ME101"

    Sunday, September 4, 2011

    Motorola S-record file

    Compilers for microcontrollers from Renesas Electronics like R8C and M16C usually output a .mot file which is a Motorola S-record file. This is a standard ASCII text file which contains the opcodes to be placed at each location within the target microcontroller's program flash memory. A programmer application software would read this .mot file and program the flash memory of the microcontroller chip accordingly. Motorola S-record format is somewhat similar to Intel HEX file format

    The following quick reference chart will help you understand the Motorola S-record file format easily - specially useful if you are developing software to parse .mot file. The diagram was based on the data presented at:

    A4 Landscape PDF File of the above diagram is here.
    I have also made this diagram available on Wikimedia Commons here and have embedded it in the SREC article on Wikipedia.

    Saturday, September 3, 2011

    Linear Barcodes

    Barcode scanners are fun, got my hand on one of these to catalog my book collection on Its easier to create the collection by scanning off the ISBNs off of books.

    Here is a random list of barcodes I scanned off of various products around my bedroom.


    Bar codes can be used to encodes lots of different kinds of data, Universal Product Codes being one of them. is a good source to figure out what each Universal Product Code Stands for:

    For example:

    This is a Bookland ISBN code, which means it's an ISBN number encoded as an EAN/UCC-13. You can tell this by the first three digits of the EAN/UCC-13 (978). The numbers after that are the ISBN. You'll notice the last digits differ, though -- EAN/UCC-13 and ISBN calculate their check digits differently (in fact, the check 'digit' on an ISBN can be a digit or the letter X).

    Here are the innards of iBall CS-153:
    The microcontroller is AT91SAM7S64

    Here is the iball Linear Barcode Scanner User Manual and Configuration Leaflet. This barcode scanner does not have any buttons on it and neither is it supplied with any application/device driver software. The bar code scanner emulates a standard USB HID Keyboard. All data read from a bar code is sent to the computer as key presses. The user manual has various bar codes printed in it. To change the settings of the barcode scanner, one has to scan the bar code associated with that configuration change and voila! the new setting will take effect immediately (of course you have to scan bar codes for "start configuration" and "stop configuration" too and you may need to power cycle the device too)

    Barcode Scanner from ZXing Team is a nice Android app which uses your cell phone's camera to read barcodes off of products and then fetches their description and price from the internet and displays the data on the screen.

    Open Source within Plain Sight

    Now days lots of consumer devices use lots of open source software.
    For example Samsung's GT-E1175 GSM Cell phones uses the following open source software:

    • Independent JPEG Group
      Independent JPEG Group is an informal group that writes and distributes a widely used free library for JPEG image compression.

    • Newlib
      Newlib is a C standard library implementation intended for use on embedded systems. It is a conglomeration of several library parts, all under free software licenses that make them easily usable on embedded products.

    • Challenge Handshake Authentication Protocol
      In computing, the Challenge-Handshake Authentication Protocol (CHAP) authenticates a user or network host to an authenticating entity.

    • MD5 Message-Digest Algorithm
      The MD5 Message-Digest Algorithm is a widely used cryptographic hash function that produces a 128-bit (16-byte) hash value. Specified in RFC 1321, MD5 has been employed in a wide variety of security applications, and is also commonly used to check data integrity
    GT-E1175 Open Source Announcement Leaflet:

    Thursday, May 26, 2011

    The thing about memset(), memcpy() & memove()

    Came across these two pieces of advice regarding the use of these library functions in C:
    • DO use memmove() instead of memcpy() in case you're dealing with overlapping memory regions.
    • DON'T try to use memset() to initialize type int, float, or double arrays to any value other than 0.
    More details hereIf you are an embedded C programmer, its worth a read.