Tag Archives: linux

Debian 7 Toshiba Lifebook T4220 Wacom stylus and tablet rotation

I was a bit frustrated…
Started with that I found jessicalitwin’s page and thought – cool! Finally I could have this little bastard of laptop working all the way!

Baseline: Stylus did not follow the screen rotation..
So, I took a silent moment and thought about it. Here’s my followup:

Installation:

Install required packages:
(su or sudo -i/sudo)

apt-get install libx11-dev libxrandr-dev gawk libxi-dev libxtst-dev libhal-dev libxosd-dev gettext build-essential linux-headers-$(uname -r)

Get the package from fjbtndrv @ sourceforge

Extract it

 tar xvvf [filename]

and perform:

./configure && make && make install && depmod -a

Now, the rotation-button will work once you reboot!
Sadly – I had a conflict of interest – the default keyboard shortcuts defines the default browser to open, on the same ‘key’ as the rotate button. Annoying, since everytime I pressed rotate, it opened a new browser..
Simply remove that mapping, see the screen shot below (System Settings > keyboard > shortcuts > launchers > Launch Web Browser).

But, since I wanted the stylus to work as well in the orientation I wanted, I added a script to the mixture;

cd
touch wacom-follow-rotation.sh && chmod +x wacom-follow-rotation.sh

The content of the file:

#!/bin/bash

# This script is called from a keyboard shortcut, currently "alt+rotate" located on the display.
# Shortcuts are defined from Settings>Keyboard>Shortcuts>CustomShortcuts
# Also remember to disable the default WWW shortcut, as it maps to the rotate button...
# Define a ERROR VAR.
ERROR=0
# Get the current wacom rotation ($state) with:

state=$(xsetwacom get "Serial Wacom Tablet stylus" rotate)
$state

if [ ! -f /tmp/wacom-follow-file ]; then
# File not found, touch it, and give it the state.
touch /tmp/wacom-follow-file
echo $state > /tmp/wacom-follow-file
fi

##
# select states from get rotate
# 0 none
# 1 ccw
# 2 half
# 3 cw

# Add the +1 logic to the states

case "$state" in
none )
newstate=ccw
;;
ccw )
newstate=half
;;
half )
newstate=cw
;;
cw )
newstate=none
;;
*)
ERROR=1
;;
esac

# Might wanna add a if error=1 exit error...

# map it into /tmp/wacom-follow-file
echo $newstate > /tmp/wacom-follow-file

# NOTE!
# Verify that your devices are named the same, or even are the same:
# xsetwacom --list devices
# Devices:
# Serial Wacom Tablet stylus
# Serial Wacom Tablet eraser

xsetwacom set "Serial Wacom Tablet stylus" rotate $newstate
xsetwacom set "Serial Wacom Tablet eraser" rotate $newstate

# We are officially... DONE

#Bail with error...
exit $ERROR

As you can see, I am not completely done yet – but it works ;).

Now, I simply added this script as a keyboard shortcut,
making use of the buttons that are still accessable while in tablet mode – Alt+Rotate.
(layout is PageUp – PageDown -Rotate – Fn – Alt on my laptop)

Trying to use it with the rotation button only, made the rotation to stop working… Therefore I use alt+rotate (yes, first you rotate the screen, then the stylus… (until I figure out how to do it better)

Keyboard Shortcuts

ddrescue

# first, grab most of the error-free areas in a hurry:

ddrescue -n /dev/old_disk /dev/new_disk rescued.log

# then try to recover as much of the dicey areas as possible:

ddrescue -r 1 /dev/old_disk /dev/new_disk rescued.log

SSHuttle and RSYNC

The annoyance of having a VPS, and just wanna do RSYNC can be.. a burden. So here’s a easy version of it.

I’ve got a RSYNC-server back home, serving and loyaly keeping my backups in one (or not..) location. But doing rsync directly over the interwebs isn’t .. well, recommended (eherm).

Here’s an easy fix for your VPS that might serve data for some reason to the interwebs, but needs some access (note, I do recommend having a separate machine for this at home, and that you firewall it propperly.. ).

Before you get SSHuttle –

You’ll need the following installed on the ‘client’:

git
python
iptables
rsync

No news, and the only thing I guess you’ll have to (or, not really – you could just download it by hand) install is git (perhaps rsync as well..).

For a vanilla debian/ubuntu system, just go:

sudo apt-get install git rsync

Get SSHuttle to the ‘client’!

git clone git://github.com/apenwarr/sshuttle

Tada!

Now, simply run ((from the dir you dl’ed it into) with sudo or su’ed as root):

./sshuttle --dns -vr user@host.name.domain 10.10.10.10/32

If you need some other information of what you can give to sshuttle, simply do:

./sshuttle

Now, this test is guessing you’ve already have setup a separate ssh-key for the user at the remote ssh-server, also that you’re done with setting up the rsync server – the 10.10.10.10/32 CIDR is just an example of the RSYNC server you with to ‘route’ to. the –dns is still in there for show – this means that our DNS queries goes via sshuttle as well.

Now simply setup your cronjob to run rsync to the ‘local’ server 10.10.10.10, and you can rest a bit easier!

When it comes to sshuttle, it’s purpose wasn’t really simply tunneling rsync. Have a poke at it, and perhaps you’ll find it a better idea to have it running on your laptop you keep insiting on using on public wifi hotspots. This means the only cleartext data anyone listening can see, will be the dns lookup to your ssh-server :). With the –dns, we simply hide all ‘leaky’ traffic.

One might argue that well, a simple ssh tunnel can do this as well. Mjes.. But then again, this is easier, and a bit more fun!

Enjoy.

skype for Linux (Ubuntu 12.04 LTS), how to break it on a 64-bit OS.

So, I destroyed my skype install with the unlinking of a few libs thanks to another 3rd party package..

Trying to clean this up is not.. fun…

$ /usr/bin/skype 
bash: /usr/bin/skype: No such file or directory

Now, that does prove an issue… And so does the following:

strace /usr/bin/skype 
execve("/usr/bin/skype", ["/usr/bin/skype"], [/* 38 vars */]) = -1 ENOENT (No such file or directory)
dup(2)                                  = 3
fcntl(3, F_GETFL)                       = 0x8002 (flags O_RDWR|O_LARGEFILE)
fstat(3, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 2), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4a5a7c8000
lseek(3, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
write(3, "strace: exec: No such file or di"..., 40strace: exec: No such file or directory
) = 40
close(3)                                = 0
munmap(0x7f4a5a7c8000, 4096)            = 0
exit_group(1)                           = ?
$ ldd /usr/bin/skype 
	not a dynamic executable

So, What am I expected to do? Cry? Well, no..

Good thing is, I cleared out the installation in a quiet but brute-ish way after the above results.
Story goes like this – a third party installation killed of a few libs that was needed for skype to.. well, live.

So I took some time on an airport and checked with aptitude what exactly those might be.

Aptitude view of skype.deb

So, then I remembered, I’m a running 64-bit OS, perhaps the ia32-libs got partially destroyed somehow?
Said and done, did the install, and swooosh, the “64-bit” version you download isn’t really 64-bit..

Then I remembered something else.. What did file say about that skype binary?

$ file /usr/bin/skype
/usr/bin/skype: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x06628ce1adec6427dabb21f1ab71194752a638ee, stripped

I’m so… sooo stupid sometimes. Of course my third party application killed of the 32-bit binaries and libs and that caused my only other 32-bit crap to die off..

So, that’s solved! :D.

blueprint

I’m a bit backlogged on submitting things, but this one I feel needs to be higlighted with a post.

Blueprinting a server installation, made easy;

Blueprint @ github <- contains the instructions below. There's some pre-reqs you need to fill first:

Debian- or RPM-based Linux
Python >= 2.6
Git >= 1.7 (not just for installation from source)

Or, if you wish to go with the easiest option:

From DevStructure’s Debian archive

echo "deb http://packages.devstructure.com $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/devstructure.list
sudo wget -O /etc/apt/trusted.gpg.d/devstructure.gpg http://packages.devstructure.com/keyring.gpg
sudo apt-get update
sudo apt-get -y install blueprint

full disk encryption linux (with pre-boot).

So, I was searching for a easy solution when it came to “whole disk encryption” (yes, I am a PGP (Corporation) fan as well), but for linux. Why? Since Symantec decided to buy the PGP Corp. any real continued development came to a halt – at a bad time. 8.04 where going dead, and 9.10 wasn’t really supported at the time (sure, 9.04 worked, but how fun was that one?). I was infuriated.. But managed to calm down a bit when discovering that for debian-based installers (Alternative for ubuntu), you can easily set up a combo of a lvm and drive encryption with the help of dm-crypt / luks.

Since a really straight forward and easy task, so I’ll just post the link:

https://help.ubuntu.com/community/EncryptedFilesystemHowto

For some more reading, I’d recommend:

Two-factor LUKS using Ubuntu


http://en.wikipedia.org/wiki/Comparison_of_disk_encryption_software
http://xtremediary.blogspot.com/2010/04/linux-luks-crypt-howto.html
http://www.privacyfoundation.de/crypto_stick/crypto_stick_english