Calibrating a 5″ Raspberry Pi touchscreen in Jessie

Previously, I posted about a 5″ touchscreen for the Raspberry Pi.

But I did not mention calibrating the touchscreen.

After a week’s holiday, I came back and sorted this fairly easily.

I was using Raspbian Jessie from NOOBS 1.8

First I installed a new utility:

sudo apt-get install xinput-calibrator

 Calibration

To calibrate the touchscreen, go to the menu>preferences>select “Calibrate touchscreen”

Touch each of the red crosses on the screen in turn, then cut and paste the resulting snippet to the following file by using this command:

sudo nano /usr/share/X11/xorg.conf.d/98-calibration.conf

(this will create a new file and open it for editing)

My entries are below:

Section “InputClass”

Identifier “calibration”

MatchProduct “ADS7846 Touchscreen”

Option “Calibration” “120 3970 205 3920” #(enter your numbers here)

Option “SwapAxes” “0”

EndSection

Ctrl-O to save, Crtl-x to exit, and then reboot, and your pointer should follow your finger correctly!

Advertisements

MythTV and a TBS HDTV (DVB-T2) Card

HDTV cards with Linux support are fairly few and far between. Although TBS support Linux, you have to compile the driver yourself.

(and again every time you update your kernel).

I Use mine in a MythTV server, running Mythbuntu 14.04

Quad core AMD 5350 Kabini processor, Asus  AM1-A miniITX motherboard, 4GB RAM, and a TBS 6280 HDTV PCIe Dual DVB-T2 tuner card.

I found that to get smooth 1080p video on the device’s screen, , the proprietary AMD drivers were necessary.

MythTV works well, I am using Kodi (XBMC) on devices around the house for streaming.

Downloading and compiling TBS HDTV card drivers

First you need to add the tools: Zip, GCC and headers:

sudo apt-get install p7zip-full unzip build-essential linux-headers-generic-$(uname -r)

TBS driver downloads:
latest one:
http://www.tbsdtv.com/download/document/common/tbs-linux-drivers_v150525.zip
or paste this into a terminal:
wget http://www.tbsdtv.com/download/document/common/tbs-linux-drivers_v150525.zip

Some people have reported problems with the latest driver, here is where to get an earlier version:
http://www.tbsdtv.com/download…
or paste this into a terminal:
wget http://www.tbsdtv.com/download…

In terminal (assuming you are in your home directory, and you downloaded the TBS driver into Downloads)
mkdir tvdrivers
cd Downloads
for the latest version:
cp tbs-linux-drivers_v150525.zip /home/tvdrivers

cd /home/tvdrivers
unzip tbs-linux-drivers_v150525.zip
tar xjvf linux-tbs-drivers.tar.bz2
cd linux-tbs-drivers

for version 141019:
cp
tbs-linux-drivers_v141019.zip /home/tvdrivers

cd /home/tvdrivers
unzip tbs-linux-drivers_v141019.zip
tar xjvf linux-tbs-drivers.tar.bz2
cd linux-tbs-drivers

for both versions:
check for version (32bit or 64bit)
uname -a
for 32 bit:
sudo ./v4l/tbs-x86_r3.sh
for 64 bit:
sudo ./v4l/tbs-x86_64.sh
You should see “TBS drivers configured for (32bit or 64 bit) platform”
sudo make

go and make a cuppa
once complete :
sudo make install
and when complete, reboot.

v4l files are stored at:
/lib/modules/(your kernel version)/kernel/drivers/media
If you have problems, it may be worth clearing this directory before compiling.
You can find out your kernel version with the command:
uname -r
You can make sure you have the correct kernel headers with the command:
sudo apt-get install linux-headers-$(uname -r)

More info and links here:
http://linuxtv.org/wiki/index….

Back from the the brink…

Sometimes the easiest things become difficult.
I decided to swap the monitor on my living room PC.
The new monitor is physically the same size, despite having a slightly larger (23″ as opposed to 22″) visible screen. It also has a higher resolution, 1920×1080 instead of 1640×1050. So I thought it would fit nicely in the bookcase where the current Samsung was.
First problem: no VESA mount, so needs the stand.
Had to move one of the shelves.
Homemade bookcase, screwed together, but not too much of a problem.
Half an hour later, boot up, on HDMI lead. no picture.
Close down, boot on vga ok.
Reboot, oops, caught power lead, pc switched off, Boot up, kernel panic.
After a short google, downloaded and tried Rescatux recovery CD.
Brilliant package! PC working again.
Now just have to figure out why monitor not working with HDMI>DVI lead.(sigh)

An alternative to LIRC for MythTV remotes

What I don’t understand is why nobody else has come up with this and posted it.
MythTV has been both a bane and a joy over the years, the main bane being getting the remote to work properly. The most annoying and recurring symptom is that most of the keys work, but for some reason, the most important, the “OK” key never does.
The latest kernel now has ir keymaps built in, unfortunately this means that my carefully crafted LIRC configuration for my Hauppuage remote no longer works, and the default keymap settings are as useless as ever, Basically, the 1-9 keys, volume controls, up, down, left and right work, but nothing else.
There must be some well hidden documentation about this somewhere, but after much use of Google and reading webpages, I came to the conclusion that to get the best results without using LIRC as a “bridge” I would need to configure my remote as a keyboard.

To do this, I basically ignored all of the internet posts and guides, apart from the ones that gave me the clues to where the keymap files were kept.
First I installed the ir-keytable package from the repositories.
This also installs a selection of ir keymaps in /lib/udev/rc_keymaps

Using the ir-keytable, command,  you can find out which drivers are in use and which keymaps they use.

on my system, it returns:

Found /sys/class/rc/rc1/ (/dev/input/event7) with:
Driver (null), table rc-dib0700-rc5
Supported protocols: NEC RC-5 RC-6
Enabled protocols: RC-5

I started by looking at the relevant keymap (dib0700_rc5) in /lib/udev/rc_keymaps, and tested the remote to see what buttons actually worked.
Then I ran ir_keytable -t > ~/devtest.txt, pressed every key on the remote in sequence from left to right descending in rows. This gave me a text file with the scancodes and their key attributes.
I then saved a copy of the dib0700_rc5 keymap, and edited it.

The first entry that I tried changing was KEY_OK.

I changed this to KEY_ENTER, rebooted, and lo! The OK key worked! I could now select items in the menus!
So basically, I edited the dib0700_rc5 keymap so that every key corresponds with a key on the keyboard, then going through the key setup in MythTV’s frontend creating links where necessary.

Unfortunately, there are a lot of keys already mapped to functions in MythTV, so this last bit was a little hit and miss, as some symbols or combinations such as CTRL+P don’t seem to work, but finally I can use every key on my Hauppuage remote. I have an MCE remote as well, but I haven’t bothered to do that one yet.
My Keymap is here

Yes I know that using devinput with LIRC as a bridge is more elegant for applications that support LIRC, but I only use a remote with MythTV, and the LIRC solution seems just too convoluted and unreliable to be worthwhile, too many links in the chain.

Note: you need to cold boot, i.e.shut down the PC and then restart it, for the new keymap to be read. I found that the remote would not work after a warm reboot, not sure why.

How much can we simplify Linux?

I just had a “First steps with Linux” article printed in a popular UK computer Magazine.

It was designed to tell  the new user what to do after they had successfully installed UBuntu.

The Distro was chosen as being the most mainstream, and I thought that too many articles on Linux drop the user after installation.

Most of the feedback on the Magazine’s forum was positive and complimetary.

Except one.

The post in question was a request for a “total idiots guide to Linux”.

Well  I thought that was what I had provided.

The poster went on to mention unfamiliar terms like “distro” and “grub” (both of which were explained in the text), followed by a

complaint about “typing symbols” and “Where should they be typed”

(again this was explained in the text)

The CLI “taster” section was less than half a page of an 8 page, 6000 word  article.

I did hesitate to include  it, but felt that it was necessary for completeness.

The poster must have skimmed the article without reading it, and picked anything that he did not instantly recognise as a problem, and then complained.

I suppose for users like that, the best advice with regard to Linux is “forget it, unless you can get someone else to set it up for you.”

I have several Linux users who would have no idea about installing or maintaining Linux, who happily use it on a daily basis, with no problems.

All the real complaints come when windows users try to install it themselves.

KDE4- the revelation

Well, after a long time as a KDE3 user, I was staring into the barrel of a warm gun.
Opensuse 11.2- KDE4.
I had to decide, move to KDE4, become (shudder) a Gnome user, or move to my best alternative- XFCE.
I had tried KDE4 in earlier incarnations, stability and usability issues stopped me experimenting further.
I finally bit the bullet and installed in a VM to test.
At first it was confusing, but once I threw away all convention and read the manual, it worked well.
After a short period of acclimatisation, it just works so well for me, I am astounded by the logicality of it all!
I have played with various GUIs, and this is a real revelation.
Not the half hearted redraw of Vista or win7, but a new, well thought out approach.

As for Opensuse, my dual monitors were identified and configured, along with my Wacom Bamboo tablet, I now have seperate Xserver settings for each login, and it just works smoothly, including interfacing to Exchange on the laptop.

Yes, it is still in development and there is the odd rough spot, but overall, a real advance in usability.
It now sits happily on my main desktop and my dual boot Work Laptop.

Bravo KDE team, and plaudits for the OpenSuse team too!

MythTV: Mythzoneminder

If  you have a PC in the living room, on constantly to record TV programs, why not make more use of it?

That’s what I thought, so I’m trying to set up Zoneminder, and the Mythtv plugin for it.

First steps:

Install  Zoneminder, Mythzoneminder

I am running Mythbuntu, with Mythweb installed and running,  so I will access this via <http://IPaddress/zm&gt; locally, or from the internet  <http://IPaddress:portnumber/zm

Put a symlink to the Zoneminder.conf file in the /etc/apache/modulesenabled directory:

sudo ln -s /etc/zm/apache.conf /etc/apache2/conf.d/zoneminder.conf

restart apache

sudo /etc/init.d/apache2 force-reload

allow apache access to video

sudo adduser www-data video

Next set up your webcam.

I am using a Logitech E3500, which is well supported in Linux, I hav e used it with Skype.

It requires the uvc cam driver, so used synaptic to install it.

Mealtime beckons, will continue tomorrow