Saturday, November 30, 2013

Lubuntu on an old Toshiba Tecra M7 laptop/tablet convertible

Over the summer I got an old Toshiba Tecra M7 (made in 2006); this is one of those laptop/tablet convertibles, where the screen can be rotated around and locked face-up over the keyboard to be used as a tablet with a stylus. So I can have fun scribbling on the screen with Inkscape and other drawing programs, then flip the screen back around and still use it as a normal laptop. It's handling XBMC playback just fine, so I don't think it's that underpowered.

Lubuntu 12.10 is currently installed and seem to be working well. The built-in wifi card is only Wireless G, which isn't bad, but I'm trying out a Tenda W311MI "Pico USB Adapter" to get Wireless N, and it's averaging 70-80Mb/s. I'm concerned about losing or damaging this tiny little adapter when packing up the laptop, since it does stick out, and when I plugged in another USB device it stopped responding. So I may still eventually replace the internal wifi card, though it looks like major surgery.

To enable screen rotation to portrait mode when using it as a tablet, I did the following, combining instructions from Steve Welburn's post here, as well as some Ubuntu forum threads that I can't seem to find anymore.

I switched to the proprietary tested Nvidia drivers (launch Software Updater, click Settings and go to the Additional Drivers tab), restarted, and then generated an xorg.conf with the following command:
Then edit the generated /etc/X11/xorg.conf and add the following to the last "Device" section
Check what the detected input devices for the stylus are:
This will produce a listing like the following: it's the Serial Wacom Tablet stylus and eraser that we want.
⎡ Virtual core pointer            id=2  [master pointer  (3)]
⎜ ↳ Virtual core XTEST pointer    id=4  [slave  pointer  (2)]
⎜ ↳ AlpsPS/2 ALPS GlidePoint      id=10 [slave  pointer  (2)]
⎜ ↳ ALPS PS/2 Device              id=11 [slave  pointer  (2)]
⎜ ↳ Serial Wacom Tablet stylus    id=12 [slave  pointer  (2)]
⎜ ↳ Serial Wacom Tablet eraser    id=14 [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)]
  ↳ AT Translated Set 2 keyboard  id=9  [slave  keyboard (3)]
  ↳ Toshiba input device          id=13 [slave  keyboard (3)]
The shell script is below, I put mine in /usr/local/bin and made a menu shortcut to it.

#!/bin/sh

# Find the line in "xrandr -q --verbose" output that contains current screen orientation and "strip" out current orientation. 

rotation="$(xrandr -q --verbose | grep 'connected' | egrep -o  '\) (normal|left|inverted|right) \(' | egrep -o '(normal|left|inverted|right)')" 

# Using current screen orientation proceed to rotate screen and input tools. 

stylus="Serial Wacom Tablet stylus"
eraser="Serial Wacom Tablet eraser"
mouse="PS/2 Mouse"
touchpad="AlpsPS/2 ALPS GlidePoint"

case "$rotation" in 
    normal) 
#    -rotate to the right 
    xrandr -o right 
    xsetwacom set "$stylus" rotate  CW 
    xsetwacom set "$eraser" rotate CW 
    ;; 
    right) 
#    -rotate to normal 
    xrandr -o normal 
    xsetwacom set "$stylus" rotate NONE 
    xsetwacom set "$eraser" rotate NONE 
    ;; 
esac
I wanted to use the "rotate" button built into the Tecra's monitor. After some Google searching I found that the following would display what keycodes were bound to it:
As it turns out, that button is bound to "Windows Key + 6". In order to trigger the hotkey, I had to edit my ~/.config/openbox/lubuntu-rc.xml and add the following at the end of the other "keybind" items:
I don't think there's a global lubuntu-rc.xml so if you want to share customized hotkeys with other users on the same computer you have to update the lubuntu-rc.xml in their profile.

And that's it!

No comments :

Post a Comment