Monday, October 25, 2010

My attempts to write a driver for my touchscreen

Output of lsusb
ishan@firebird:~/Desktop/nexio$ lsusb
Bus 001 Device 008: ID 17e9:401c Newnham Research 
Bus 001 Device 007: ID 15c2:3480 SoundGraph Inc. 

Output of lsusb -vvv -d 15c2:3480
ishan@firebird:~/Desktop/nexio$ sudo lsusb -vvv -d 15c2:3480

Bus 001 Device 007: ID 15c2:3480 SoundGraph Inc. 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x15c2 SoundGraph Inc.
  idProduct          0x3480 
  bcdDevice           22.68
  iManufacturer           1 SoundGraph,Inc.---
  iProduct                2 SoundGraph.Inc
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           84
    bNumInterfaces          3
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      2 Mouse
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      74
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0004  1x 4 bytes
        bInterval              10
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      1 Keyboard
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      65
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval              10
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      50
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
Device Status:     0x0000
  (Bus Powered)
ishan@firebird:~/Desktop/nexio$ cd ~
ishan@firebird:~$ clear

ishan@firebird:~$ sudo lsusb -vvv -d 15c2:3480

Bus 001 Device 007: ID 15c2:3480 SoundGraph Inc. 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x15c2 SoundGraph Inc.
  idProduct          0x3480 
  bcdDevice           22.68
  iManufacturer           1 SoundGraph,Inc.---
  iProduct                2 SoundGraph.Inc
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           84
    bNumInterfaces          3
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      2 Mouse
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      74
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0004  1x 4 bytes
        bInterval              10
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      1 Keyboard
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      65
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval              10
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      50
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
Device Status:     0x0000
  (Bus Powered)

Output of  cat /proc/bus/input/devices

I: Bus=0003 Vendor=15c2 Product=3480 Version=0111
N: Name="SoundGraph,Inc.--- SoundGraph.Inc"
P: Phys=usb-0000:00:02.1-2.2/input0
S: Sysfs=/devices/pci0000:00/0000:00:02.1/usb1/1-2/1-2.2/1-2.2:1.0/input/input8
U: Uniq=
H: Handlers=mouse1 event6 
B: EV=17
B: KEY=70000 0 0 0 0 0 0 0 0
B: REL=103
B: MSC=10

I: Bus=0003 Vendor=15c2 Product=3480 Version=0111
N: Name="SoundGraph,Inc.--- SoundGraph.Inc"
P: Phys=usb-0000:00:02.1-2.2/input1
S: Sysfs=/devices/pci0000:00/0000:00:02.1/usb1/1-2/1-2.2/1-2.2:1.1/input/input9
U: Uniq=
H: Handlers=kbd event7 
B: EV=120013
B: KEY=10000 7 ff9f207a c14057ff febeffdf ffefffff ffffffff fffffffe
B: MSC=10
B: LED=1f

IMON REMOTE OUTPUT

Green On Button

(ON) f169f280 2324865157 C Ii:009:03 0 64 = 4102eda9 81140000 00000000 00000000 00000000 00000000 00000000 00000000
(OFF)f169f280 2324865157 C Ii:009:03 0 64 = 4102eda9 81140000 00000000 00000000 00000000 00000000 00000000 00000000

Red Off Button

f169f280 2383989569 C Ii:009:03 0 64 = 4102eda8 89140000 00000000 00000000 00000000 00000000 00000000 00000000
f169f280 2384077570 C Ii:009:03 0 64 = 4102edaa 89140000 00000000 00000000 00000000 00000000 00000000 00000000

Backspace

f16b4c00 2416237712 C Ii:009:02 0 8 = 00002a00 00000000
f16b4c00 2416365708 C Ii:009:02 0 8 = 00000000 00000000


Context

f16b4c00 3240431566 C Ii:009:02 0 8 = 00006500 00000000
f16b4c00 3240559563 C Ii:009:02 0 8 = 00000000 00000000



Up

f169f280 2891351935 C Ii:009:03 0 64 = 4102eda8 a5540000 00000000 00000000 00000000 00000000 00000000 00000000
f169f280 2891479935 C Ii:009:03 0 64 = 4102edaa a5540000 00000000 00000000 00000000 00000000 00000000 00000000

Down
f169f280 2910525421 C Ii:009:03 0 64 = 4102eda8 a9140000 00000000 00000000 00000000 00000000 00000000 00000000
f169f280 2910633419 C Ii:009:03 0 64 = 4102edaa a9140000 00000000 00000000 00000000 00000000 00000000 00000000


Left
f169f280 2923424078 C Ii:009:03 0 64 = 4102eda8 a5940000 00000000 00000000 00000000 00000000 00000000 00000000
f169f280 2923572071 C Ii:009:03 0 64 = 4102edaa a5940000 00000000 00000000 00000000 00000000 00000000 00000000


Right
f169f280 2938735662 C Ii:009:03 0 64 = 4102eda8 a5d40000 00000000 00000000 00000000 00000000 00000000 00000000
f169f280 2938843660 C Ii:009:03 0 64 = 4102edaa a5d40000 00000000 00000000 00000000 00000000 00000000 00000000


Enter
f16b4c00 2953287281 C Ii:009:02 0 8 = 00002800 00000000
f16b4c00 2953415277 C Ii:009:02 0 8 = 00000000 00000000


VOL +
f169f280 3007009826 C Ii:009:03 0 64 = 4102eda9 c5140000 00000000 00000000 00000000 00000000 00000000 00000000
f169f280 3007117826 C Ii:009:03 0 64 = 4102edab c5140000 00000000 00000000 00000000 00000000 00000000 00000000


VOL -
f169f280 3019136501 C Ii:009:03 0 64 = 4102eda9 a5140000 00000000 00000000 00000000 00000000 00000000 00000000
f169f280 3019264501 C Ii:009:03 0 64 = 4102edab a5140000 00000000 00000000 00000000 00000000 00000000 00000000


CH +
f169f280 3031549169 C Ii:009:03 0 64 = 4102eda9 c9140000 00000000 00000000 00000000 00000000 00000000 00000000
f169f280 3031697166 C Ii:009:03 0 64 = 4102edab c9140000 00000000 00000000 00000000 00000000 00000000 00000000


CH -
f169f280 3039634953 C Ii:009:03 0 64 = 4102eda9 e1140000 00000000 00000000 00000000 00000000 00000000 00000000
f169f280 3039782951 C Ii:009:03 0 64 = 4102edab e1140000 00000000 00000000 00000000 00000000 00000000 00000000


MUTE
f169f280 3048486714 C Ii:009:03 0 64 = 4102eda9 a9d40000 00000000 00000000 00000000 00000000 00000000 00000000
f169f280 3048655715 C Ii:009:03 0 64 = 4102edab a9d40000 00000000 00000000 00000000 00000000 00000000 00000000


PREV
f169f280 3059580413 C Ii:009:03 0 64 = 4102eda8 c1940000 00000000 00000000 00000000 00000000 00000000 00000000
f169f280 3059749415 C Ii:009:03 0 64 = 4102edaa c1940000 00000000 00000000 00000000 00000000 00000000 00000000


PLAY/PAUSE
f169f280 3070339132 C Ii:009:03 0 64 = 4102eda8 c1540000 00000000 00000000 00000000 00000000 00000000 00000000
f169f280 3070487124 C Ii:009:03 0 64 = 4102edaa c1540000 00000000 00000000 00000000 00000000 00000000 00000000


NEXT
f169f280 3078564907 C Ii:009:03 0 64 = 4102eda8 c1d40000 00000000 00000000 00000000 00000000 00000000 00000000
f169f280 3078631907 C Ii:009:03 0 64 = 4102edaa c1d40000 00000000 00000000 00000000 00000000 00000000 00000000



##########################################################################################################################################################################

Keyboard Event Filters


right context

f6921200 3501699824 C Ii:002:01 0 8 = 00006500 00000000
f6921200 3501755822 C Ii:002:01 0 8 = 00000000 00000000

Enter
f6921200 3547370595 C Ii:002:01 0 8 = 00002800 00000000
f6921200 3547410591 C Ii:002:01 0 8 = 00000000 00000000


Backspace
f6921200 3574265871 C Ii:002:01 0 8 = 00002a00 00000000
f6921200 3574337872 C Ii:002:01 0 8 = 00000000 00000000

##########################################################################################################################################################################

Mouse Event Filters

Right context

f686a180 3618554684 C Ii:003:01 0 5 = 02000000 00
f686a180 3618618682 C Ii:003:01 0 5 = 00000000 00




Thursday, October 21, 2010

Where is the OBD Port in Fiat Linea. Illustrated Guide

OPen the fuse box Right next to steering column
The connector highlighted is the Std OBD II connector

Another View

Sunday, October 17, 2010

Configuring Soundgraph FingerVU 706 on Ubuntu 10.04

This is the first post on my blog. As the title suggests, this blogs describes how to configure Soundgraph USB Monitor FingerVU 706 to work as an extended monitor on Ubuntu 10.04 (32 bit).  ( Presently the monitor works only as a display and I have not been able to configure the remote control or touch screen input)

Due to paucity of time and most importantly patience, the guide is written in 'Cut the crap out' style.

Before one proceeds ahead it is important that your system is updated and has latest updates installed.

sudo aptitude update
sudo aptitude upgrade



Once you have achieved this, it is time to get new kernel updates


cd ~/Desktop
mkdir new_kernel
cd new_kernel

wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.34-lucid/linux-headers-2.6.34-020634_2.6.34-020634_all.deb
dpkg -i linux-headers-2.6.34-020634_2.6.34-020634_all.deb

wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.34-lucid/linux-headers-2.6.34-020634-generic_2.6.34-020634_i386.deb
dpkg -i linux-headers-2.6.34-020634-generic_2.6.34-020634_i386.deb

wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.34-lucid/linux-image-2.6.34-020634-generic_2.6.34-020634_i386.deb
dpkg -i linux-image-2.6.34-020634-generic_2.6.34-020634_i386.deb



In next step we shall install dependencies and compile latest package from the git core

sudo apt-get -y install libusb-dev xorg-dev xserver-xorg-video-displaylink git-core
cd ~/Desktop
mkdir libdlo
cd libdlo
wget http://people.freedesktop.org/~berniet/libdlo-0.1.2.tar.gz
tar -xzpf libdlo-0.1.2.tar.gz
cd libdlo-0.1.2
./configure
sudo make install


Now is time to edit /etc/gdm/Init/Default file. Insert following lines of code in the file where the gdmwhich() function ends


XRANDR=`gdmwhich xrandr`
if [ "x$XRANDR" != "x" ] ; then
$XRANDR -o 0
fi


Now comes the most tricky and important step of rewriting your /etc/X11/xorg.conf file.
Most importantly backup your existing xorg.conf file so that you can recover from a crash


sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.orig


Once this is achieved, I suggest that you replace contents from /etc/X11/xorg.conf file with this

Section "ServerLayout"
Identifier "touchscreen"
Screen 0 "DisplayLinkScreen" 0 0
EndSection

Section "Files"
ModulePath "/usr/lib/xorg/modules"
ModulePath "/usr/local/lib/xorg/modules"
EndSection

Section "Device"
Identifier "DisplayLinkDevice"
Driver "displaylink"
Option "fbdev" "/dev/fb0
EndSection

Section "Monitor"
Identifier "DisplayLinkMonitor"
EndSection
Section "Screen"
Identifier "DisplayLinkScreen"
Device "DisplayLinkDevice"
Monitor "DisplayLinkMonitor"
SubSection "Display"
Depth 16
Modes "800x480"
EndSubSection
EndSection


Connect your monitor and reboot your PC. You should be able to see the GDM greeter on your usb display. If you have reached till here, you are doing fine. In case gdm crashes, it is most probably due to two reasons firstly junk characters pasted or wrong frame-buffer device path.
Presently /dev/fb0 works for me. If you suspect this change this to /dev/fb1. You can find the framebuffer devices installed by simply doing ls /dev/fb*.

Assuming that you are on track till here. Drop to another virtual console. We shall revert back to our original file which we have backed up and backup the existing configuration


cd /etc/X11/
sudo mv xorg.conf xorg.conf.fingervu706
sudo cp xorg.conf.orig xorg.conf
sudo service gdm stop
sudo service gdm start


Now you shall have a black screen on your USB monitor and gnome desktop on VGA/DVI display
Following steps need a bit of trial and error and understanding of xorg.conf file directives. I am posting contents of three files.
My original xorg.conf.orig file
FingerVU config file xorg.conf.fingervu706
and lastly and most importantly, my working merged xorg.conf file merging directives from both the files above

xorg.conf.orig

############ Original Video Settings ###########
Section "Screen"
Identifier "Default Screen"
DefaultDepth 16
EndSection

Section "Module"
Load "glx"
EndSection

Section "Device"
Identifier "Default Device"
Driver "nvidia"
Option "NoLogo" "True"
EndSection


xorg.conf.fingervu706

Section "ServerLayout"
Identifier "touchscreen"
Screen 0 "DisplayLinkScreen" 0 0
EndSection

Section "Files"
ModulePath "/usr/lib/xorg/modules"
ModulePath "/usr/local/lib/xorg/modules"
EndSection

Section "Device"
Identifier "DisplayLinkDevice"
Driver "displaylink"
Option "fbdev" "/dev/fb0
EndSection

Section "Monitor"
Identifier "DisplayLinkMonitor"
EndSection
Section "Screen"
Identifier "DisplayLinkScreen"
Device "DisplayLinkDevice"
Monitor "DisplayLinkMonitor"
SubSection "Display"
Depth 16
Modes "800x480"
EndSubSection
EndSection


Merged and working xorg.conf file


############ Original Video Settings ###########
Section "Screen"
Identifier "Default Screen"
DefaultDepth 16
EndSection

Section "Module"
Load "glx"
EndSection

Section "Device"
Identifier "Default Device"
Driver "nvidia"
Option "NoLogo" "True"
EndSection
################################################
Section "ServerLayout"
Identifier "DualDisplay"
Screen 0 "DisplayLinkScreen" 0 0
Screen 1 "Default Screen" LeftOf "DisplayLinkScreen"
EndSection
Section "Files"
ModulePath "/usr/lib/xorg/modules"
ModulePath "/usr/local/lib/xorg/modules"
EndSection

Section "Device"
Identifier "DisplayLinkDevice"
Driver "displaylink"
Option "fbdev" "/dev/fb0
EndSection

Section "Monitor"
Identifier "DisplayLinkMonitor"
EndSection
Section "Screen"
Identifier "DisplayLinkScreen"
Device "DisplayLinkDevice"
Monitor "DisplayLinkMonitor"
SubSection "Display"
Depth 16
Modes "800x480"
EndSubSection
EndSection


Some Pictures of my rig



References and Thanks to

http://karuppuswamy.com/wordpress/2010/07/19/how-to-get-lilliput-displaylink-based-usb-monitor-um-70-17e902a9-working-in-ubuntu-linux/
http://libdlo.freedesktop.org/wiki/
http://ubuntuforums.org/archive/index.php/t-1493143.html
http://mulchman.org/blog/?tag=displaylink