Sunday, February 27, 2011

More about the touchsceen and multitouch

Hey everybody,
 So for the longest time I had things a bit switched up in my mind, I talked about multitouch and enabling the touchcreen as though they were one and the same...but they're not. Merely enabling the touchscreen allows the OS to register the "touch" events, mainly where you clicked and a mouse click...multitouch says that you've used more than one finger and thus two/three locations would be registeted instead.

In my post about installing ubuntu I don't make much of a distinction, in fact I used the terms interchangeably. All that changed when my friend Reiner told me about twofing, which basically captures multitouch events and does special things with particular windows such as scroll forward in evince if you swipe two fingers acoss the screen.

Well first off et me describe how to get the multitouch driver installed. Please note that if you had gotten the touchscreen to work using the method described in the Ubuntu installation post, you will need to undo these changes...namely remove the usbhid.quirks changes to the GRUB file and remove the 99-calibration.conf file rom /etc/X11/xorg.conf.d/

Next you will need to make sure you have added the utouch-team repository to the ubuntu packager (you may not need the unstable repo anymore)

sudo add-apt-repository ppa:utouch-team/utouch
sudo add-apt-repository ppa:utouch-team/unstable

sudo apt-get upgrade
sudo apt-get update


Next, download the egalax drivers:


sudo apt-get install hid-egalax-dkms


You should now be good to go. Restart the machine. For some reason I was getting weird behavior on my first restart and had to manually shut down the machine by holding down the power button. But the next time it loaded up it was fine...so in case you run in to any problems...restart again, if it persists across more restarts then you have a different issue.


Now if you recall, we had rotation scripts...well those won't work anymore, atleast not the way they are at the moment. Instead your files should now look like so:



#normal.sh

#!/bin/sh

xrandr -o normal
xinput set-int-prop 9 "Evdev Axes Swap" 8 0
xinput set-int-prop 9 "Evdev Axis Calibration" 32 0 32760 0 32760
xinput set-int-prop 10 "Evdev Axes Swap" 8 0
xinput set-int-prop 10 "Evdev Axis Calibration" 32 0 32760 0 32760

 -----------------------------------------------


# rot.sh
#!/bin/sh

xrandr -o left

xinput set-int-prop 9 "Evdev Axes Swap" 8 1
xinput set-int-prop 9 "Evdev Axis Calibration" 32 32760 0 0 32760
xinput set-int-prop 10 "Evdev Axes Swap" 8 1
xinput set-int-prop 10 "Evdev Axis Calibration" 32 32760 0 0 32760


It took me a bit to figure out the settings, but basically it looks like the hid-egalax driver granulates the screen differently (and possibly with different scales depending on what axis).

You should now be running with multitouch support and at the same point where the ubuntu installation post left off.

The next bit just explains where the coordinates above came from. If you're not interested in that, well then you're done and can go enjoy!

If you run xinput_calibrator you will get some output that looks like:

Warning: multiple calibratable devices found, calibrating last one (eGalax Inc. USB TouchController)
    use --device to select another one.
Calibrating EVDEV driver for "eGalax Inc. USB TouchController" id=10
    current calibration values (from XInput): min_x=0, max_x=32760 and min_y=0, max_y=32760

Doing dynamic recalibration:
    Setting new calibration data: -29, 32920, 387, 32606

 Now I'm mainly interested in the bolded line, it tells us what the default values for the perfectly functional landscape setup is. The new calibration is ok, but you will find that it isn't perfect.

Ok so let's cut that up, it seems to say that in landscape mode, the lower left corner of the screen is at coordinates (min_x,min_y) which is (0,0).

What about the max? That's our upper right corner of the screen, (max_x,max_y) which is (32760,32760).

So the calibration string with min_x, max_x, min_y, max_y will be:
0 32760 0 32760

Ok, well what happens when we rotate the screen. Well we need to set the new lower left corner of our screen but using the same coordinate system as before. So our screen's origin (new lower-left corner) is now where (32760,0) used to be and the new upper right corner is at (0,32760) thus the new calibration string  with min_x, max_x, min_y, max_y will be:
32760 0 0 32760

Well that's all folks. Next time I will explain how I got twofing to work.
Cheers!

Saturday, February 26, 2011

Screen Rotation with Ubuntu on WeTab

Update 26 OCT 2011:
If you're running Ubuntu 11+ please check out this post instead: http://wetabz.blogspot.com/2011/06/rotating-wetab-screen-on-natty-narwhal.html

======================================

So holding up the WeTab for long periods of time can be a pain. Sometimes it seems that holding it up on it's side might be more comfortable, especially when you're lying down in bed and trying to read something.

well as it so happens, you can rotate the screen using xrandr. You might not like what you see but atleast you have the option.

Well first do an xinput -list to see the devices you can interact with to fix up calibration through a script:

xinput -list
⎡ Virtual core pointer                        id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                  id=4    [slave  pointer  (2)]
⎜   ↳ eGalax Inc. USB TouchController             id=9    [slave  pointer  (2)]
⎜   ↳ eGalax Inc. USB TouchController             id=10    [slave  pointer  (2)]
⎜   ↳ eGalax Inc. USB TouchController             id=11    [slave  pointer  (2)]

⎜   ↳ ImPS/2 Generic Wheel Mouse                  id=15    [slave  pointer  (2)]
⎜   ↳ Microsoft Mouse                             id=16    [slave  pointer  (2)]
⎣ Virtual core keyboard                       id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard                 id=5    [slave  keyboard (3)]
    ↳ Power Button                                id=6    [slave  keyboard (3)]
    ↳ Video Bus                                   id=7    [slave  keyboard (3)]
    ↳ Power Button                                id=8    [slave  keyboard (3)]
    ↳ USB 2.0 Camera                              id=12    [slave  keyboard (3)]
    ↳ Asus Laptop extra buttons                   id=13    [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard                id=14    [slave  keyboard (3)]
    ↳ Microsoft Keyboard                          id=17    [slave  keyboard (3)]

Note the ids for "eGalax Inc. USB TouchController" 


As a quick test to check which device really is the one we need to calibrate we can take each of the ids and plug it in to the following command and then touch the screen with a finger, if the Axes seem to be inverted, we know we have the right device:

xinput set-int-prop 9 "Evdev Axes Swap" 8 1
xinput set-int-prop 10 "Evdev Axes Swap" 8 1
xinput set-int-prop 11 "Evdev Axes Swap" 8 1


Once you know which device id is the right one (mine was 10), you can restore the proper axes by switching the 1 to a 0:

 xinput set-int-prop 10 "Evdev Axes Swap" 8 0

you should now create the following scripts that will help you rotate and restore your view.


#rot.sh
#!/bin/sh

xrandr -o left
xinput set-int-prop 10 "Evdev Axes Swap" 8 1
xinput set-int-prop 10 "Evdev Axis Calibration" 32 4052 36 35 4156



#norm.sh
#!/bin/sh

xrandr -o normal
xinput set-int-prop 10 "Evdev Axes Swap" 8 0
xinput set-int-prop 10 "Evdev Axis Calibration" 32 -5 4100 59 4100



* remember to change the device id 10 to whatever works for you. I describe next what to do about the calibrations.


Finally make sure you download and install xinput_calibrator: http://www.freedesktop.org/wiki/Software/xinput_calibrator (the debian package should do).



Now do a xrandr -o left and run the xinput_calibrator. The output should be the calibration parameters that you place on the last command of both scripts (evdev  axis calibration).


Finally run the scripts and enjoy the proper calibrations of both landscape and portrait viewing on your WeTab!


UPDATE 26 FEB 2011:
---------------------------------------
The above instructions will work only if you are running with single-touch, to enable multitouch and have rotation work correctly please see: http://wetabz.blogspot.com/2011/02/more-about-touchsceen-and-multitouch.html

 

Maximimized Onboard keyboard problem

So while messing around with the onboard keyboard I double-clicked it's top bar by mistake and ended up with the keyboard totally covering my screen. To further complicate things, in UNR, the maximize/close/minimize buttons are hidden, so there is basically no way to change the size of the onboard window once it is maximized.



After a good hour or so of tinkering I fell upon this discussion:
https://answers.launchpad.net/onboard/+question/127746

So basically all you need to do is use a normal keyboard to launch gconf-editor from a terminal and then go under /apps/Onboard and change the Height and Width settings and relaunch onboard and it should be fine from then on.

One mistake I did make was I had su-ed and was configuring the wrong profile, which prolonged my confirming the solution.

debb1046 mentioned twofing which should allow you to use two fingers to scroll and do some fancy multitouch things with ubuntu (I believe you have to make sure you install the ppa/utouch).


Cheers

Friday, February 25, 2011

WeTab Ubuntu Installation


So I've finally had the time to open up my WeTab again and start fiddling around with it. Actually I had sort of given up on the WeTab a bit, especially after the seeing the Bookman reader on IPad work so beautifully and then comparing that with the readers for WeTab...they don't compare unfortunately. Additionally the performance of the OS leaves a lot to be desired.

In any case, I've made my peace with the WeTab and started caring for it once more. So here without ado, I explain how I went about installing Ubuntu on it.

1- Download the NetBook Remix 10.10 iso (Maverick)
2- Download the Universal Ubuntu USB installer on a windows machine (You could also use Ubuntu to do it, refer to the link I provide below).
3- Download GParted Live (USB version)
4- Make available a USB flash drive, preferably with an LED light
5- USB Mouse and Keyboard (preferably wireless with one receiver to make things easier otherwise you will be doing quite a bit of plugging and inserting)
First off you will need to put GParted on the flash drive (http://gparted.sourceforge.net/liveusb.php#linux-method-b).

Now you should be ready to repartition your WeTab Flash Drive. To do this, connect your USB Flash to the USB port on your WeTab and boot from the USB drive.

To boot from the USB disk is kind of tricky, have a look at the developer page: http://wetab.mobi/en/developers/downloads-and-howtos/
(HowTo – Install WeTab OS with Recovery USB Boot Stick)

Basically you turn on the Wetab and then as soon as you see the blue led in the top left corner light up, press both the power-button and the quicktouch button (top left corner) together for approximately 1 second. It takes a bit of practice to get that just right so don't give up if it doesn't work right away but what should happen then is that your GParted Live should boot up from the USB flash drive.

You can use the quicktouch button on the upper left corner of the WeTab to browse through the Boot menu for Gparted. One touch switches between the option, if you hold down on the quicktouch button, it selects the entry. I chose "other modes of Gparted" and then "Run from RAM or memory", this way you can pull out the USB flash drive once it is done loading up the OS.

Once you're in GParted you will want to started up the GParted application (if it doesn't automatically load up). Select the sda3 partition (the biggest one) and then Resize. My WeTab has 32GB, So I resized mine to allow 8 GB for Ubuntu.

It should take about 15 minutes to resize the partitions.

Once that is done you should create a USB Installer for Ubuntu, just follow the directions on http://www.ubuntu.com/netbook/get-ubuntu/download where it says Create a USB Drive (click show me how).

Again now, just like we had booted up the GParted image off of our USB flash, you should boot up the Ubuntu Installer from the flash drive.

Once it loads up and asks you to Try or Install, choose Install Ubuntu. Follow along on the screens to come. When it asks you where you would like to Install the system, choose "Install along side another OS". At this point you can just let it go on and do it's thing however, the bootloader will be replaced and you will get Ubuntu's GRUB if you reboot. I chose instead the "Manual" option and basically clicked on the unallocated space, created an ext3 partition and marked it as / (root) for Ubuntu to install on it. On the bottom where it asks you where the Bootloader should go, I selected sda4 which is the new partition we created earlier.

Go ahead and Install Ubuntu and then once it is done, restart and go into your original WeTab Os.

You must now modify the extlinux.conf file under /boot/extlinux/extlinux.conf in order to load up Ubuntu.

Add the following lines at the bottom of you extlinux.conf

label Ubuntu
menu label ^Ubuntu
KERNEL chain.c32
APPEND hd0 4

Notice the Append tells extlinux that the logical partition sought for booting is on harddrive 0 and partition 4 (/dev/sda4), where we installed Ubuntu along with it's own GRUB loader.

Next we need to modify the GRUB settings for our Ubuntu installation to enable the touchscreen. Restart the machine and go into your Ubuntu install from the bootup menu (use the quicktouch button to select the Ubuntu install).

Once you are inside Ubuntu, open up a terminal session (click the ubuntu button on the top left corner, type "terminal" in the search bar and then double click the icon when it shows up.

Now to enable the touchscreen we must follow Samiux's and W3C's directions (http://samiux.blogspot.com/2010/07/howto-ubuntu-1004-on-gigabyte-touchnote.html and http://digitalorchard.blogspot.com/2010/12/wetabos-to-pure-meego.html but follow along don't do what is on those pages, I'll cut and paste here).

First off you want to change the GRUB loading parameters as Samiux describes, but you need to follow W3C's advice regarding the correct hexadecimal value to add in. So first do an lsusb:

$>lsusb
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 002: ID 04d9:a015 Holtek Semiconductor, Inc.
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 002: ID 0eef:72a1 D-WAV Scientific Co., Ltd
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 004: ID 04f2:b213 Chicony Electronics Co., Ltd
Bus 002 Device 003: ID 12d1:1404 Huawei Technologies Co., Ltd.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

note the ID value and place the same values as follows in your GRUB configuration file, Grub 2.o uses a cfg file so go to your /etc/default/grub and modify it to look like the following.

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash i8042.noloop=1 usbhid.quirks=0xeef:0x72a1:0x40"

Finally, you should copy the Xorg calibration files from the original WeTab Os to your Ubuntu install (actually I am not sure if this step is needed):

$>sudo mount /dev/sda1 /mnt/
$> sudo mkdir /etc/X11/xorg.conf.d
$>sudo cp /mnt/etc/X11/xorg.conf.d/99-calibration.conf /etc/X11/xorg.conf.d

Now I will make note also that I had updated my utouch drivers as follows but I believe the above will work regardless, if you have any feedback please post it below. I suggest you try the above first and if it doesn't work, then do the below.

sudo add-apt-repository ppa:utouch-team/utouch
sudo add-apt-repository ppa:utouch-team/unstable

sudo apt-get upgrade
sudo apt-get update

Finally, you should start the virtual keyboard onboard:

$>onboard

You will notice the "onboard" icon on the left toolbar. Right-click the icon and select "Keep in launcher", also open preferences and check "show keyboard when unlocking".

Cheers!


UPDATE 26 FEB 2011:
---------------------------------------
The above installation enables only single touch, to enable multitouch on Ubuntu on WeTab, please see: http://wetabz.blogspot.com/2011/02/more-about-touchsceen-and-multitouch.html