A quest, get the CF-19 front keys working!

Due to overwhelming demand, we have created a forum just dedicated to Toughbook users who use Linux!
Message
Author
User avatar
SHEEPMAN!
Posts: 2239
Joined: Thu Oct 14, 2010 1:13 pm
Location: TDR-HQ California

Re: A quest, get the CF-19 front keys working!

#11 Post by SHEEPMAN! »

I never say:
1. "It's no problem."
2. "just"
3. "simply"
4. "what could possibly go wrong?"

Meanwhile devyl welcome to the forum and to the Linux section in particular. :D

Maybe kodeniner knows a little. (:) He's very good) Glitch is making advances also on the front buttons.

I am more of a hardware guy and just blunder my way around the software part enough to get things working. I never tried to compile, write scripts (well maybe one time).

Do some searching on xrandr. Problem is to get the touchscreen/touchpad rotating as well. But the front buttons aren't showing anything that I recognize.

Again welcome.

Jeff.....hmmmm...interesting ghost movements of the touchpad....color me distracted. :help:

OT: Mismatched ram....finally put two 1GB sticks of tested 6400 in it and the ghost went away. Strange indeed. CF-74G. Cancel the :help: J.
Fair for you/ Fair for me.
I chose to NOT be organized.

-------------------------------------------------------------------[/color]
http://toughbooktalk.com/
http://forum.notebookreview.com/panasonic/

User avatar
kode-niner
Posts: 700
Joined: Sat Jun 07, 2014 7:39 am
Location: Canada

Re: A quest, get the CF-19 front keys working!

#12 Post by kode-niner »

Man, I actually posted around here about creating a rotate script but never went through with it. I use my CF-19's less now because, compared to the CF-30, the battery life is horrible. I'll have to get off my arse and "just do it".
Daily drives a CF-31

User avatar
kode-niner
Posts: 700
Joined: Sat Jun 07, 2014 7:39 am
Location: Canada

Re: A quest, get the CF-19 front keys working!

#13 Post by kode-niner »

Heh, why bother when it was already done? (that's what I meant by déjà vu)
http://www.toughbooktalk.com/viewtopic. ... e&start=10

I might just fire up the 'ole 19.
Daily drives a CF-31

glitch
Posts: 61
Joined: Sun Dec 07, 2014 2:39 pm
Location: Around Kansas City

Re: A quest, get the CF-19 front keys working!

#14 Post by glitch »

What devyl is saying is down load the zip from github and
unzip it, run make. Then install it, so after unzipping it, on
your terminal it would look like:

you@yourComputer: /home/you/unzippedFile# ls
Makefile panasonic-hbtn.c
you@yourComputer: /home/you/unzippedFile# make

... displays stuff ...

you@yourComputer: /home/you/unzippedFile# ls
Makefile modules.order Module.symvers panasonic-hbtn.c panasonic-hbtn.ko panasonic-hbtn.mod.c panasonic-hbtn.mod.o panasonic-hbtn.o

you@yourComputer: /home/you/unzippedFile# insmod panasonic-hbtn.ko

**Note I was root in this terminal use su or sudo as you wish when installing**

I did this and the center button in that row causes an entry on the terminal,
BUT it does not do anything else. Also the other buttons are still inert.

I plan on having a complete solution and printing complete instructions so
this can be solved AND implemented by any user. That means mapping the
buttons and sending output to programs.

What I am going to suggest is posting full instructions, not a quick snippet.

If you fixed it and it works, Great! But unless you can convey how you did this to the rest of us its not really that great for us.

To start the example, I am posted my full text of my failures, :eek: starting at the beginning of this thread.

Maybe somebody will see something I did wrong and can get us pointed in the right direction.

I knew this would not be a short project hence the title including "Quest". Also in a quest, sometimes you don't find what you're looking for
and I knew that was possiblity also.

Its the middle of my semster, I get spring break in 2 weeks and think that I may tackle this at that point.
glitch

CF-19 Mk-1 / CF-M34 / CF-27 / CF-28 / CF-29 Mk-1 / CF-H1 Field/Health

“The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way.” Heraclitus ~5 bc

User avatar
kode-niner
Posts: 700
Joined: Sat Jun 07, 2014 7:39 am
Location: Canada

Re: A quest, get the CF-19 front keys working!

#15 Post by kode-niner »

Finally did it.

Here's my script bound to the rotate button. Credit goes to scottie4442 for doing the leg work for finding sources online here and there and actually following through. His script rotates to one side only which is what he needs. Mine will rotate 360 degrees, 90 degrees at a time each time you press the button. As far as binding it to my desktop environment, I just use Openbox' wonderful hotkey binding capabilities to XF86RotateWindows. This is after installing the panasonic_hbtn module which I seem to have done several months ago. I can't find that original topic where we'd discussed this. Only 5 out of 6 buttons are recognized, the keyboard button being the one that doesn't work.

Code: Select all

#!/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.

case "$rotation" in
    normal)
    # rotate to the left
    xrandr -o left
    xinput set-prop 'Fujitsu Component USB Touch Panel' 'Coordinate Transformation Matrix' 0 -1 1 1 0 0 0 0 1
    ;;
    left)
    # rotate to inverted
    xrandr -o inverted
    xinput set-prop 'Fujitsu Component USB Touch Panel' 'Coordinate Transformation Matrix' -1 0 1 0 -1 1 0 0 1
    ;;
    inverted)
    # rotate to the right
    xrandr -o right
    xinput set-prop 'Fujitsu Component USB Touch Panel' 'Coordinate Transformation Matrix' 0 1 0 -1 0 1 0 0 1
    ;;
    right)
    # rotate to normal
    xrandr -o normal
    xinput set-prop 'Fujitsu Component USB Touch Panel' 'Coordinate Transformation Matrix' 1 0 0 0 1 0 0 0 1
    ;;
esac
Name the file rotate, chmod +x rotate to make it executable, put it somewhere in your path like /usr/bin or /usr/local/bin or whatever, and type rotate in a shell to test it. Let me know if I'm being too vague and need a step by step.


Edit: you might need to install xrandr and xinput if it's not on your system by default.

For xrandr: apt-get install x11-xserver-utils
apt-get install xinput
Last edited by kode-niner on Thu Mar 24, 2016 11:04 am, edited 1 time in total.
Daily drives a CF-31

User avatar
kode-niner
Posts: 700
Joined: Sat Jun 07, 2014 7:39 am
Location: Canada

THE QUEST HAS REACHED ITS CONCLUSION

#16 Post by kode-niner »

QUEST OVER.
THIS INSTALL SCRIPT WILL ENABLE FRONT PANEL BUTTONS AND ADD A ROTATE SCRIPT TO YOUR CF-19 ON LINUX. It won't bind the buttons to the rotate script or any other events since that is dependent on your desktop environment and hotkey utilities, so you have to figure that out with the help of this thread, which I guess is sort of a side quest. :D Anybody care to test this out on a CF-19?

Now this really bugs me because I have already installed this module a long time ago and never followed through with binding a rotate script. I can't find that original discussion either here or in NBR.
EDIT: Actually I found it and it was previously discussed here. I found all the info, bookmarked it all then forgot it. I must have simply become busy or uninterested in pursuing it for some reason, or I'm simply losing my mind.
EDIT 2: Credit goes to Favux on the LInux Mint forums for his Tablet PC Rotation How to.
Heiher for the panasonic_hbtn kernel module
scotti4442 here on TBT for finding this stuff about a year ago. Where is that dude? He hasn't logged in here since May last year.
And thanks to glitch for helping light a fire under my ass with this thread. I have a bad habit of not finishing stuff I start around here.
EDIT 3: Added checks for xrandr and xinput in script, with a few other touch-ups.

Brief summary:
1) unzip the file
2) run install.sh as root or sudo
3) assign XF86RotateWindows to /usr/local/bin/rotate in your appropriate hotkey editor utility.


WHAT YOU NEED FIRST:
Check that you have make, xinput and xrandr by just typing the commands to see if they exist.
On Debian, make and xinput are provided by packages of the same name and xrandr is part of x11-xserver-utils.
For make, you might also need header files which is provided by the metapackage linux-headers on Debian. You'll realize this when the make portion of the script runs and throws up "missing header" or similar errors.

Download the panasonic-hbtn.zip file attached to this message. It contains the CF-19 kernel module to enable the front buttons, the rotate script for rotating your screen while transposing tablet calibration coordinates and an easy to use install script that I also discuss a bit in this message. Unzip the file with whichever method suits you, filemanager or command then run the install.sh script as a superuser. You might need to reboot.


For example, I have downloaded this in /home/nick
The file is effectively /home/nick/panasonic-hbtn.zip
I have unzipped it and the resulting directory is /home/nick/panasonic-hbtn
Then I will change directories into /home/nick/panasonic-hbtn with a shell/terminal to run the install.sh script contained therein.
(cd /home/nick/panasonic-hbtn)



If you use sudo:

Code: Select all

sudo ./install.sh
If you're like me and don't use sudo then login as root or su

Code: Select all

su
./install.sh

This is a quick and dirty shell script that will
1) check that you are root
2) check for the presence of 'make'
3) try to compile the module then install it if it's not already there
4) copy the rotate script in /usr/local/bin
5) warn you if you are missing xinput and xrandr in your $PATH

If it works, you should be able to test it by typing "rotate" in a shell and your screen will rotate while keeping your tablet calibrated.

It's not the most well thought-out script so it might fail. For starters, I'm not checking for header files or missing symbols. It won't destroy your system, however. This is the contents of install.sh that I am asking you to test (again, it's already in the zip file):

Code: Select all

#!/bin/bash
ISMOD=`lsmod|grep panasonic_hbtn`
ISMAKE=`which make`
ISXINPUT=`which xinput`
ISXRANDR=`which xrandr`
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR
if [ "$EUID" -ne 0 ]
  then printf "Please run as root\n"
  exit
fi
if [ -n "$ISMOD" ]
  then 
    printf "The panasonic_hbtn module is already installed.\n\n"
    printf "Copying the rotate script to /usr/local/bin \n\n"
    cp -i rotate /usr/local/bin
    chmod +x /usr/local/bin/rotate
  exit
fi
if [ -n "$ISMAKE" ]
    then
      printf "Installing Panasonic front panel button module...\n\n"
      make clean
      make
      insmod panasonic-hbtn.ko
      printf "Copying the rotate script to /usr/local/bin \n\n"
      cp -i rotate /usr/local/bin
      chmod +x /usr/local/bin/rotate
    else
      printf "\"make\" command not found!\n"
      printf "You need to have a valid compiler installed.\n"
      printf "You might need to install \"make\" or check to see if it's in your PATH.\n"
    exit
fi
if [ ! -n "$ISXINPUT" ]
    then  printf "You need to install \"xinput\" for the rotate script to work.\n"
fi
if [ ! -n "$ISXRANDR" ]
    then  printf "You need to install \"xrandr\" for the rotate script to work.\n"
fi
The only relevant section in this install script above are the following commands that we are discussing in this thread, which you could execute individually:

Code: Select all

      make
      insmod panasonic-hbtn.ko
      cp rotate /usr/local/bin
      chmod +x /usr/local/bin/rotate






This kernel module that glitch dug up again only may only work partially. The keyboard button does not work for me, but seemed to work for scotti4442 and he had another key that didn't work. I am not sure if this hardware or software related, yet. Help!

How you link these buttons to what you want them to do, like execute the rotate script, is dependent on your desktop environment or window manager. You would have to have a hotkey utility that allows you to assign applications or scripts to keyboard event names. It would be great if some of you could detail how it's done with whatever you're running.

The event names are as follows, left to right on the CF-19's front panel:
XF86MonBrightnessDown
XF86MonBrightnessUp
(keyboard button doesn't work for me)
Return
XF86RotateWindows
XF86ScreenSaver

The first two seemed to work without the kernel module. What the heck is Return used for? (don't re-map this). XF86ScreenSaver is presumably used with a Windows screensaver that is configured to ask for a password on wakeup.


With my Debian LXDE Openbox, I added this to ~/.config/openbox/lxde-rc.xml between the <keyboard> </keyboard> sections. Disregard if you're not running Openbox:

Code: Select all

<keybind key="XF86RotateWindows">
   <action name="Execute">
      <command>/usr/local/bin/rotate</command>
   </action>
</keybind>
Attachments
panasonic-hbtn.zip
(3.92 KiB) Downloaded 352 times
Last edited by kode-niner on Thu Jun 16, 2016 8:23 am, edited 7 times in total.
Daily drives a CF-31

UNCNDL1
Posts: 509
Joined: Wed Nov 16, 2011 8:01 pm
Location: New England

Re: A quest, get the CF-19 front keys working!

#17 Post by UNCNDL1 »

I'm glad for all the work everyone has put into this. I have a 19 sitting here and gathering dust, so I'll make this my next project. I do have a question, though. What operating system would you start with? I.e. Debian, etc...
CF-53 MX-Linux 21 Wildflower
CF-30 MK2 SSD MX-21 Betsy, MK2 Navigatrix, Fundraiser for TbT
CF-52 GUN SSD MX-19
(NICE) Thanks Sadlmkr
CF-M34 MicroWattR8 Thanks Sadlmkr
CF-M33 MicroWattR8 Thanks Springfield

User avatar
kode-niner
Posts: 700
Joined: Sat Jun 07, 2014 7:39 am
Location: Canada

Re: A quest, get the CF-19 front keys working!

#18 Post by kode-niner »

Whichever suits you, I suppose. I will always stay upstream with Debian, but I can't fault anybody for preferring something with a shinier desktop environment. However I don't see why this shouldn't work on other than Debian-based or Ubuntu branches, like Slackware Redhat or whatever. It just needs to have a compiler for installing the module and the packages containing xinput and xrandr for the screen rotation.
Daily drives a CF-31

EdFromBJCS
Posts: 71
Joined: Thu Apr 03, 2014 2:28 pm

Re: A quest, get the CF-19 front keys working!

#19 Post by EdFromBJCS »

Will this work on a CF-18?

User avatar
kode-niner
Posts: 700
Joined: Sat Jun 07, 2014 7:39 am
Location: Canada

Re: A quest, get the CF-19 front keys working!

#20 Post by kode-niner »

I honestly don't know. It shouldn't hurt anything to try.
Daily drives a CF-31

Post Reply

Return to “The LINUX forum!!!”