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"
    to
    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


    MessageContent="5553424312345678000000000000061e000000000000000000000000000000"

    MessageContent2="5553424312345679000000000000061b000000020000000000000000000000"

    NeedResponse=1


    CheckSuccess=10
  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.
References:
Notes:
  • 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: http://www.amelek.gda.pl/avr/uisp/srecord.htm




    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 librarything.com. 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.


    LUSDJ0D165050038A11601 
    4718235227159
    8904149401006
    8903539010200
    8901124715332
    9788184890266
    9781408809594
    9780595142361
    9780007428052
    9780743440295
    9722121221225
    LXPG40C0269290B9161601 
    92904738216
    SA00000183A
    4902430281232
    355067048902647
    HT13XTJ26185
    99HMN005-00
    4710937348842
    205000001519991
    W1255ZCZC00072R
    884912116505
    8901499006653
    037000230151
    8901491503051
    8901491104555
    8902080504060
    8902570801860
    8901138714550
    8901424008332
    8901396465003
    8901030207068
    8901023005800
    8901396144007
    8901396112136
    8902570801471
    4902430354332
    8901396151258
    8901571001248
    8901012155035
    8901393004700
    89000816
    8901207900839
    8901233008011
    8901063004023
    8901063035034
    8901876001035
    SLF02A067030004802
    8901207503559
    8901207503221
    6589726583256
    884898315176
    4800888142238
    8901296102121
    8901180118023
    8901860010517
    4711734822603
    6932008080019
    8906016571058
    074470584933


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

    For example:

    9781408809594
    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.