Category Archives: technical

Fauxdacious Version 3.82-final Released

Fauxdacious Version 3.82-final Released for Linux and Windows: 

* Fully updated the Fauxdacious Github site and will now keep changes updated there as commits.

* Added the ability to capture the thumbnail images (“cover art”) associated with youtube video streams. This also involved changing the youtubedl_metadatahelper.pl script.  It now uses youtube-dl to fetch and download the thumbnail file when the other tag metadata is fetched.  By default, it stores them in the /tmp directory, but you can change this in the aforementioned perl script.

* GTK equalizer:  Added the [Auto] checkbox, (and relabeled the [Reset to Zero] button to [Flat] to make room for it), and added a two-state indicator icon to the [Preset] button to indicate whether a song-specific preset file is currently in use (so the GTK equalizer now works the same way the Winamp Skins equalizer).

* Fixed playlist column headers in the QT interface to work like the GTK version, labeling all unlabeled column headers using the same abbreviations we used in GTK.  Also on the QT side, there’s an optional “Now Playing” column (header was blank, but is now labeled “On”) which was useless (always blank), but now shows an asterisk next to the currently playing song (The GTK side does not offer this column, but the currently playing song is displayed in bold type).

* Tweaked instance name / dbus handling by adding instance names to the window titles (as Audacious does with their instance numbers) and also making numbers valid as instance names allowing one to specify the commandline option “-#” (ie. -1, -2, etc. in lieu of “–new=1, etc.) for compatability with Audacious.  The config directories work the same as Fauxdacious instance names with underscores, ie. ~/.config/audacious_1 (~/.config/audacious_instancename) instead of ~/.config/audacious-1, etc. though.  TODO:  Quitting the QT interface exits with a bunch of “dbus errors” (warnings) (even before these changes) that I haven’t been able to explain, though everything still shuts down normally.

* More leaks, more tweaks to ffaudio-core.cc (video playing) and others.  So far this seems to have pretty much eliminated memory-usage growth creep when using SDL1 and further reduced it for SDL2.  Audio-only in both appears to be leak-free.  I have not yet been able to completely isolate the source of the slight growth in SDL2 (over repeated play of a video) though.  Also added new config option:  [ffaudio].video_render_scale.  Default is 1, but valid values are 0, 1, or 2.  Sets the SDL_HINT_VIDEO_RENDER_SCALE_QUALITY hint value.  I think I also have the “black video screen on replay” issue on the Windows version fixed.  TODO:  The only remaining issue is that the video window still doesn’t always close when exiting Fauxdacious with the video window playing (on Windows version only – this was never an issue except on Windows).

* Merged in Audacious pull request #45:  “Add SOCKS proxy support.” as written.

* Merged ALL Audacious commits since 2119d19 through b216d4e; and (since then) 0ee73f2, d1463c1, 8700688, 217a39f, 4da2cb8, 236ee1d, d6e115e, and f47bede; and plugin commits since ab45ec5 through 585518c (everything through 2/13), including their resolution of the issue with plugin pull# eaf7949; and (since then) 5e9fc66, f4c9b02, 5b50d20, and 400825a.

Fauxdacious version 3.82-beta2 Released

Fauxdacious Version 3.82-beta2 Released for Linux and Windows: 

* Tweaked and generally tidied up ffaudio-core.cc a bit to make sure AVPackets are efficiently initialized and freed properly and slightly optimized play by eliminating some redundant video function checks and inlining some calls while attemping to eliminate rare and occasionally random seg-fault when stopping audio stream play.  There still appears to be a slight bit of memory leakage? / growth creep in video play, but my guess it’s somewhere deep in the bowels of SDL.

* Changed The default “video_qsize” value from 8 to 6 and added new config option: [ffaudio].allow_highdpi (default FALSE) to enable SDL2’s SDL_WINDOW_ALLOW_HIGHDPI flag.

* Merged in all latest QT stuff (finally) and tested and seems to work!  NOTE:  I did not build it into this release to save file sizes, so you must recompile yourself if you want QT configuring with “–enable-qt”!  NOTE2:  Audacious’s QT interface is rather behind, for example Equalizer presets and Plugin parameters are NOT currently configurable from the GUI.

* Merged in Audacious pulls# 40237df, 6d9acec, bb439b0, d17911e, 425aa54, 2119d19; and plugin pulls# ab45ec5.  Did NOT merge plugin pull# eaf7949 due to compile error under g++.

* Includes all unreleased Version 3.82-beta1 changes (below):

(Not released) Version 3.82-beta1

* Added new config file option:  [audacious].eqpreset_nameonly (boolean) which causes the first question mark (if any) and anything following it in a URL to be removed for purpose of exporting song-specific equalization presets. This is needed for some live-streaming station URLs that change “keys” dynamically and regularly. Default is FALSE (old behavior – keep the full url base name), add and set to TRUE for the new behavior. For example, this will affect youtube-dl urls as well, as previously the preset file would be exported as “watch?xxxxxx.preset” where “xxxxxx” was the actual video id.  With the new option, exporting song-specific equalizer presets will be the same preset file “watch.preset”.

* Fixed the exporting of song-specific equalization presets for cuesheet (.cue) files.  This worked before Audacious aparantly fixed the file-name used when opening a song for playback from it’s cuesheet filename to the actual referenced file-name, breaking our logic.  As a result, the equalization presets exported for a cuesheet file will apply to all tracks in the cuesheet.  They are still exported (reguardless of track) as “<filename>.cue.preset”.  I made the decision to do it this way assuming that all tracks in a cuesheet are (very likely) recorded with the same equalizer settings.

* Merged in Audacious plugin pulls# 2c267a2

TBT – My Favorite ’80s Software (WinDOS and PC-Write)


MS-DOS Executive Main Screen
MicroSoft Windows “MS-DOS Executive” main window (courtesy Wikipedia)
Today, I decided to take a walk down memory lane and dust off one of my oldest and favorite programs that I wrote back in the late ’80s:  “WinDOS(tm)”.  This was my first semi-graphical application and my first “file-manager”.  This was during the heady days of MS-DOS.  Children, if you don’t know what MS-DOS was, ask your folks!  At that time, Windows was new and at version 3.  There was no internet, very little graphical software for personal computers (Windows was coming onto the scene to change all of that forever though)!  My computers at the time (at home and at work) were still running “MS-DOS 5” and few had Windows, which (as Windows always does) required purchacing new, beefier (and pricier) hardware.  There were one or two computers at work that had Windows and so I got to play around a bit with it, but the interface was clunky and different and I was still USED to working in DOS which involved working a lot from the command line (what was known then as the “C> Prompt”)!  Meanwhile, Windows had this interesting little “app” called “MS-DOS Executive“, which was their early attempt at what we would now call a “file manager”.  I liked the new “mouse-based” interface that Windows offered.  In my daily workflow I found myself as a software developer often repeating a handful of commands with different files, ie. “Copy, Edit, Compile, Link, and Execute”, etc.  I looked at MS-DOS Executive to make this simpler, but alas, it didn’t really seem to work at all the way I was used to in DOS and besides, it was only for Windows, and I couldn’t afford Windows anyway, nor had it at work.
WinDOS Main Screen
WinDOS “WinDOS Executive” main screen
I wanted something similar for MS-DOS, something that would allow me to select a command (or “.BAT” script), select a file (or more than one file for commands like COPY) with a mouse, and click and run.  I also wanted to be able to do the same with the keyboard when my hand wasn’t on the mouse, and be able to click once on a list of the last dozen or so commands I had just executed to repeat them (or make a slight edit to one and run it again).  There was a cool program called “Norton Commander” (now the free “Midnight Commander” for Windows and Linux) which provided this capability, but it (like nearly all software applications and utilities at the time) cost money!  I was already writing some programs at home using the “Modula II” language and the $89 Logitech Modula II compiler (Yes, boys and girls, Logitech USED to make software back in the day, not just mice and keyboards!) for personal computers and MS-DOS!  So (being me) I decided to write my own program for MS-DOS and call it “WinDOS” (a combination of Windows and DOS, sort of a “poor man’s version of MS-Windows”).  I even patterned the main screen to look something like Windows’ “MS-DOS Executive” window but instead captioned “WinDOS Executive” and including the date and time and a “C> Prompt” for quick-typing and editing DOS commands (when my hand was on the keyboard).  WinDOS permitted me to greatly automate my workflow using a mouse to launch commands and programs while still providing enhanced keyboard-editing and entry of DOS commands!  MS-DOS Executive provided customized “.PIF” files as an early version of file/mime type associations and I quickly found myself needing something similar so I created text-based “.CIF” files (Command Information Files) to handle that in WinDOS, for example COPY.CIF configured WinDOS to prompt for TWO arguments for the COPY command.  I also created a “GUI” for creating and editing “CIF” files and an “installer” program and made it available as share-ware (open-source) and installable from a single floppy-drive!  One interesting programming feature was that I wrote WinDOS with an executable and a looping batch script to invoke it so that when the user executed a command, the WinDOS executable would exit freeing up nearly all of the 640K of system memory to run the program, then restart the WinDOS executable after the command finished.  This freed a lot of memory without noticably sacrificing speed.  My effort was not in vain as WinDOS quickly became one of my most-used programs for several years (along with the shareware / open-source editor “PC-Write(tm)”, which I also ended up purchasing the paid version because I loved and used it so much) until I finally moved my world to Linux in the mid ’90s (I pretty much skipped Windows all together)!  Heck, I even had several coworkers using WinDOS on their machines too!
Now that I’ve been on Linux for nearly twenty years now, I’ve long since developed my own file-manager (since I couldn’t find one that I liked) that incorporates the same basic principles as WinDOS, but also all the modern features one would want in a file-manager.  This is “JFM4“.  You can get it and see a screenshot on my download site.

Spiral-bound PC-Write(tm) Users’ Manual
PC-Write(tm)“, by Quicksoft (Bob Wallace and his wife Megan Dana) was my other fav. app. in my MS-DOS years as it provided a very nice and customizable full-screen (and full-color) text editor that was great for editing program source-files and writing letters, etc.  It was both a good code-editor and (for the time) a full-featured auto and manual-formatting word-processor, and it was free and shareware, and fit on a single floppy disk, so I could carry it anywhere with me!  I liked and used it so much, I ponied up the $69 (I believe) for the “fully-registered” (paid) version for which Quicksoft sent me a fully spiral-bound 426 page plus index manual (fully written and illustrated in PC-Write itself by Bob’s wife Megan Dana, seen on the cover), a free one-year subscription to their (paper) newsletter “Quicknotes”) and two free update coupons!

I got more than my money’s worth out of this program too using it for all my code development and word-processing needs for nearly ten years until I switched from DOS to Linux.  I wrote a full customization file (text file) with the colors and keyboard sequences all set the way I wanted to facilitate my work in the ways most natural to me.  After moving to Linux, I ended up writing my own full-color text editor named “E Editor” taking many ideas from this one and adding language-specific syntax-colorizaton, code-evaluation, and quick-compile that I still use today and you can get it (and JFM4) here from my download site for Windows and Linux.  “E” is not a full-blown word-processor though (I use LibreOffice for that).

PC-Write(tm) Intro screen
PC-Write(tm) Intro screen
PC-Write(tm) Editer screen
PC-Write(tm) Editer screen (editing an ancient FORTRAN program)

Fauxdacious For Windows (with executable installer) Released!

Introducing
I’m happy to announce my latest release of the Fauxdacious Media Player (version 3.83-beta1) with a full-functioning Windows version complete and bundled with a simple to use executable installer program created using the free and open Inno Setup Wizard!    (Get it Here:  http://phoenixcomm.net/~jturner/Fauxdacious_install.zip)  If you’re not familar with Audacious / Fauxdacious, it’s an audio and (with Fauxdacious) video player for both Linux/Unix and Windows.  Why use Fauxdacious instead of another video player?  With Fauxdacious, you also get one of the best audio player engines with many audiophile-ish sound-enhancing plug-ins!  Another reason is that unlike most Windows-based media players, Fauxdacious and Audacious are fully free and open-source programs with no binary blobs for malware to hide in!  One feature of interest to many Windows users is the option to use the classic “WinAmp Skins” interface, which uses the same “skins” as the old Windows “WinAmp” media player (see the bottom screenshot).  The default interface is the more modern-looking “GTK” interface, but it’s easily switchable to the WinAmp interface in [File].[Settings].(Appearance): Interface plug-in: and change the dropdown menu, then select your “skin”.  To turn on the video-playing option, simply select [Settings].[Plugins].[Input tab].[x] FFmpeg Plugin, then [Settings button] and check the box: “[x] Play video streams in popup window…”.
I understand the Audacious Team has now also created an installable version of their Windows version for v3.8.  This closes Audacious-rejected feature request #613.  This culminates nearly three weeks of hard work to build this thing for Windows.  I had held off doing this until I had a new machine with a huge hard disk that I could dedicate plenty of space for the Windows 7 partition in order to accomodate downloading the MingGW C++ compiler and compiling and installing all the three dozen or so libraries needed to compile this thing from scratch on Windows.  Thanks to the Audacious Team’s detailed and concise instructions for building on Windows, I was able to do this with only a few minor glitches (all now resolved).  For the brave techies, the gory build instruction details (including the issues I encountered and corrected) are included in the “Fauxdacious/share/” directory (fauxdacious_buildnotes.htm) created by the installer when you install (or the audacious/contrib/win32/notes.html file in the source tarballs, downloadable separately from the same site).
UPDATE (3/18/17):  Version 3.83-beta1 Released
UPDATE (3/8/17):  Version 3.82-final Released
UPDATE (2/16/17):  Version 3.82-beta2 Released
UPDATE (1/31/17):  Version 3.81-final Released!

* Added ability to directly play tunein.com radio stations using the station’s tunein.com website url (as opposed to having to manually dig out the actual live-streaming urls).  This requires the new helper script in the contrib/ directory (getTuneinStream.pl) installed in your path, and installing the new Perl modules “LWP::Simple” and “Tunein::Streams” from CPAN (www.cpan.org).  NOTE:  On Windows version, you’ll need to add the config file line:  tunein_helper=getTuneinStream.exe to the [audacious] section (This file will likely be in c:\Users\<your-user-id>\AppData\Local\audacious\config created after the first time you run fauxdacious)!

* Added headers to all columns in GTK playlist.  Previously, some column headers were not shown since they were longer than the default column width (as determined by a boolean array ui_playlist_widget.cc:pw_col_label).  I added a separate array of “short” names (columns.cc:pw_col_headers) so that all columns are now properly labeled and understood without making them unnecessarily wide.

* Merged in Audacious pulls# 361a6fc, c3b0659, b96fbd4, c1fe83b, 11e4915, 8bea900, 25dd624, 65af13f; and plugin pulls# 25dd624, 0bcc904, 0abceec, eb3e8a8, 45c1f38, a21e4a2

* Fixed Audacious-rejected bug# 681 to make pause just do pause, as it should!

* Fixed audtool –help to work even if unable to connect to dbus.

* Merged in Audacious pulls# 5297008, a67d6be, b321ee5, and c3287dd; and plugins pulls# bf6661e, 403020b and 8174f13, addressing Audacious bugs: 560 and 685.

* Added comments as another optional column field to the playlist table (GTK interface) and made it sortable.  I had started to add this and (on the SAME day, the Audacious team added it, so I dropped my work and merged theirs!  The files I changed were almost identical to their changes, but they had finished the ones I hadn’t gotten to).  I wanted to make each column sort when clicking on the header (like my Tk::HMListbox), but this was going to be a huge boondoggle.

Fauxdacious Installer
Fauxdacious Initial Setup Screen – Inno Setup Wizard
Fauxdacious Screenshot
Screenshot of Faudacious playing a video and using the default WinAmp skin with the main, playlist, and equalizer windows all displayed.
UPDATE (11/16):  Version 3.8-final Released!

* Fixed two huge memory leaks in ffaudio by using smart-pointers to open input file, frames, and properly flushing and destroying queues.

* Added queueing for audio packets when playing video.  This makes for smoother video-play while allowing for a reduction in the queue-size which improves audio-video syncing.  The default “video_qsize” value is now 8 instead of 16.

* Added separate config option [youtubedl].video_qsize (default: use [ffaudio].video_qsize) for Youtube-DL video streams, which seem to need a bigger queue.

* Removed the [Services].[Eject CD] from Windows version, since it doesn’t work anyway because it requires a command that is not included with Windows.

* Added a few lines of code to copy selected playlist entry URLs / files to the PRIMARY selection when copying so that they can be retrieved / pasted into other applications.

* Merged in latest Audacious v3.81 beta commit:  (plugins.wavout) 5ddf097, closing Audacious bug#676.

TODO:  (FIXED in v3.82-beta1):  The only known unresolved issues (Windows version) are audio is sometimes lost when jumping from some videos to audio playlist items when using the SDL Output plug-in, non-issue if using the new Waveout plug-in, and the Windows version does not always shut down the video window when shutting down without stopping playback first.  Avoidable by stopping playback before shutting down program.  Windows version also sometimes produces black playback window when stopping and restarting play on same item fixable by advancing playlist.  I Also probably need to add a “file-association” in the Windows setup wizard to associate .xspm (playlist files) with Fauxdacious.  I need to create a DEB package too, but looking at the documentation howto for that just gave me a headache.  At least John Lindgren’s Audacious build instructions for Windows were concise by comparisen!

UPDATE (10/31):  Version 3.8-beta2 Released 

* Added config-based file for user-added tag metadata and new config-file option:  [Audacious].user_tag_data.  Specify TRUE to activate this feature, FALSE or omit to keep old behavior. This permits user to save “song info” for streams (urls) and other files who’s decoder does not permit saving tag metadata into the media file itself.  I added this to be able to assign readable titles to radio streams that otherwise just show the (useless) url in the title making it difficult to see which station I’m playing.

* Added the song info popup “balloon” that currently pops up over the playlist when the user has the existing option “show_filepopup_for_tuple” option set to TRUE to also pop up now for the currently-playing song when user hovers the mouse over the middle (equalizer / time part) of the main window (Winamp Skins interface) whenever the main window is “shaded” (rolled up into a thin line).  This now makes it possible to see what is playing without having to pop up the playlist (since nothing regarding the current song is otherwise displayed when the main window is shaded)!

* Massively improved video window-resizing, tweaked video-scaling smoothness to improve video quality back to SDL1 level (fixed small degradation in SDL2).

* Added resizing feature to allow user to shrink video window below a user-specified size (default 149×149, user-configurable by the 2 new config file variables:  [ffaudio].video_doreset_width and ffaudio].video_doreset_height) and have it snap back to it’s originally-requested size.

* Fixed video-play to work in headless mode.

* Additional minor tweaks to improve video efficiency.

UPDATE (10/25):  Version 3.8-beta1 Released  Snapshotted latest Audacious v3.8 GIT as of 2016/10/13 and manually refactored and reapplied all Fauxdacious features and changes.

* Rewrote the ffmpeg plugin (ffaudio-core.cc) to use SDL2 for video and latest ffmpeg / avcodec API while remaining backward-compatable with prev. ffmpeg release (now compiles without warnings (these were all “depreciated” warnings).  This also eliminates muting issues on playback when using the SDL “Output” audio system and the nasty manual-editing of separate Makefile and extra.mk files for Linux and Windows. Also refactored and tweaked to slightly better optimize video performance and include all Audacious v3.8 improvements possible (excluding their new “SmartPtr” and “Scoped” structs) which I was not able to get fully working compatably with Fauxdacious video features.

* Added a [Close] button to the Equalizer window in the GTK interface.

* Merged in post-3.8 final commits:  97257b6 and (plugins) 43a6bf1.

UPDATE (5/31):  Version 3.74-beta2  Fixed glitch that prevented creating song-specific Equalizer Auto-presets for Cue-file based songs. Added the song / video title to the Fauxdacious Video window titlebar.  Merged Audacious commits:  3be5957, 450984e, e12ae5d, 2349933, d768ae1, 3cd305e, 60c4632, 475490c, 5384dc5, b855336, b34cbdb, c729ff5, ad0a172, 6b5bfae, 96a19b5, 5a8d6e5, and Plugin commits:  4ededd4 and ebf17e6.  Eliminated (most) compiler warnings in ffaudio-core.cc from “depreciated” AVCodec stuff. Obtained a working version of libcue and compiled that in. Updated the Win32 build notes in the contrib directory to reflect additional Fauxdacious requirements and fixes for module compilation issues.  Added the Inno Setup build file (Fauxdacious.iss) to the share directory.  If you don’t trust me fearing that I might’ve put any malware (I didn’t!) in Faudacious, you can download the full source and build instructions to examine and or re-build it yourself!

Make Special HP Laptop Touchpad Toggle Key Work In Linux

I recently purchased a new (refurbished) HP “Elitebook” 8440p laptop (see previous blog post) and docking station, and installed my custom “remastered” copy of Antix Linux!  Before buying, I had tried out my remastered Antix live-DVD on my wife’s laptop (same model with lower resolution screen) and everything basic seemed to check out.  As I expected, this laptop has proved to be a great laptop for Linux but I’ve been somewhat surprised at the number of additional (and difficult) issues/hacks I’ve had to resolve/make to my (already very customized) remastered linux installation.  In my previous post I described the nightmare I went through getting Linux to boot with Windows 7, though this is not at all a fault of the computer or it’s hardware, but rather owing to the way Windows 7 was partitioned and installed.  Another hack / workaround I ended up having to make (after another extended, but fruitless search) was downgrading my “AccelMethod” from “SNA” back to “UXA” in my /etc/11/xorg.conf file to stop screen corruption and lockup when exiting X without having to add a “chvt 1; sleep 2” sequence to each logout/exit/reboot command script in the window-manager, and disabling the “Ctrl-Alt-Backspace” command.  Switching to “UXA” eliminated the need for these workarounds (after I tried everything else I could come up with).  This machine has a LATER version of Intel graphics (Mesa DRI Intel Ironlake Mobile x86/MMX/SSE2).  The tradeoff is a slight reduction in video performance from up to 2000 fps to around 1700 or so, only really noticeable by running glxgears (My Dell never broke above 900 fps, but WORKED flawlessly with SNA!).
The hardware was very similar (driver-wise) to that of my old Dell D620, but more modern (Intel CPU, Intel integrated graphics, sound, and network interfaces).  The first issue that needed tweaking was to activate all the custom special-function keys.  Nearly all laptops have them and they all seem to be different not only between brands, but also between models.  I had long ago gotten the Dell’s all working using a now rather old program called “hotkeys”, however, I had not used them in ages since my Dell has not had a working battery since forever, and I’ve been using it almost exclusively docked (and the lid closed).  I’ve found that hotkeys seems to not work well anymore due to trouble staying up between suspends, etc.  I began looking for a better solution and found “xbindkeys”. This program also includes a GUI which permits you to actually press each key and then add your desired action command and builds the config. file for you!  This strategy proved successful for all the special keys, including the little “led” light-up ones above the keyboard that look more like status indicators than press-able keys.  The only ones not configurable via xbindkeys were the “wifi switch” led/key and the “touchpad toggle” led/key.

~/.xbindkeysrc:

     #Quieter
     "/usr/bin/amixer -q set Master 4- unmute"
         m:0x0 + c:122
         XF86AudioLowerVolume

     #Louder
     "/usr/bin/amixer -q set Master 4+ unmute"
         m:0x0 + c:123
         XF86AudioRaiseVolume

     #MuteToggle
     "/usr/bin/amixer -q set Master toggle"
         m:0x0 + c:121
         XF86AudioMute

     #Display
     "sudo /usr/local/bin/switchdisplay.sh"
         m:0x0 + c:235
         XF86Display

     #Internet
     "/usr/local/bin/browse.pl"
         m:0x0 + c:180
         XF86HomePage

     #LockScreen
     "/usr/local/bin/screenoff"
         m:0x0 + c:160
         XF86ScreenSaver

     #Dimmer
     "/usr/local/bin/setbacklight.sh -60"
         m:0x0 + c:232
         XF86MonBrightnessDown

     #Brighter
     "/usr/local/bin/setbacklight.sh 60"
         m:0x0 + c:233
         XF86MonBrightnessUp

     #ScreenToggle
     "/usr/local/bin/togglebacklight.sh"
         m:0x0 + c:248
         NoSymbol

     #Suspend
     "sudo /usr/local/bin/s2ram"
         m:0x0 + c:150
         XF86Sleep

The wifi key “works” in that it uses rfkill to toggle the wifi.  For most people, this will probably work fine out of the box, but I configure my networks manually, and need for the wifi to go off (and ethernet to come on) when docking so that my home network comes up on the ethernet connection (I needed to be able to execute a custom script whenever this key was pressed).  I ended up getting this key working by adding an ACPI event and script (see below).
/etc/acpi/events/hp8440p-wireless:

     event=PNP0C14:01 00000080 00000000
     action=/etc/acpi/hp-wifi-jwt.sh

In Linux Live-CD:

/etc/acpi/hp-wifi-jwt.sh

     event=PNP0C14:01 00000080 00000000
     #!/bin/sh

     test -f /usr/share/acpi-support/key-constants || exit 0

     . /usr/share/acpi-support/key-constants

     wifiblocked=`rfkill list wifi|grep "yes"`
     if [ "X$wifiblocked" = "X" ]; then
         echo "..WIFI BUTTON PRESSED: wifi not blocked!" >>/tmp/acpi.dbg
         #DO WHATEVER TO RESTORE PREV. CONNECTION:
     else
         echo "..WIFI BUTTON PRESSED: wifi BLOCKED!" >>/tmp/acpi.dbg
         #DO WHATEVER WE WANT WHEN WIFI TURNED OFF:
     fi

HP Touchpad Toggle Led/KeyI got all the special HP light-up buttons above the keyboard working with xbindkeys EXCEPT the one that looks like a tiny touchpad, that’s supposed to toggle the touchpad.  That little bugger just did not want to work, not even in Windows-7?!  The “touchpad toggle” led/key lights up cyan on startup and the touchpad is enabled.  Pressing it turns it orange and (should) disable the touchpad. Touching again turns it back to cyan (should re-enable touchpad).  In reality, it does nothing but change color when pressed.  X does not see it except the very first time it’s pressed, in which case xev sees a continuous spewing of keypresses and releases of keycode 138 killable by pressing Ctrl-C.  dmesg reveals that the kernel sees the alternate press as unassigned scancode “e058”.  Subsequent presses produce nothing visible to X until you reboot.  I tried adding the setkeycodes command the kernel suggested, googled and googled and could not find anything that would make this key visible to X. The console program showkey would show it alternately returning keycode 138 and keycode 140 (the one I assigned with setkeycodes) as I wanted, but for some reason nothing in X could see anything when the key was pressed.  Obviously, the key was seen by the kernel.  Several google pages described how to “translate” these kernel keycodes to X, including xmodmap, but nothing worked.
It was not like this particular key was very important to me, but at this point it had just become a determined challenge to force it to work!  I finally stumbled upon a tiny C program that could monitor the keyboard input device and report each key pressed.  I ended up modifying this program to look for these two keycodes and calling a command whenever one was seen.  I then set this program up as a tiny daemon so that I can now press the key and toggle the state of the touchpad!  Why?  Because I could and because I had already wasted too much time trying to figure this out!  😀
I finally found, stole and hacked up a tiny daemon C program that DOES make it work!  You need to do the following:
1)  in rc.local or somewhere in startup scripts add: /usr/bin/setkeycodes e058 140
2)  compile this little C program “keycheckd” (gcc -o keycheckd keycheckd.c) and place the compiled binary in /usr/local/bin/, and chown 4755 keycheckd
3)  In your X desktop session’s startup script do (must be started from w/n X desktop, NOT startup or console!):

     xset -r 138 -r 140 -r 146 -r 148
     keycheckPid=`pidof keycheckd`
     [[ "X$keycheckPid" == "X" ]] && /usr/bin/nice -n 10 /usr/local/bin/keycheckd &

The source (keycheckd.c) (note: you could add other keysyms / actions, if needed):

#include <stdlib.h>>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <linux/input.h>
#include <string.h>
#include <stdio.h>

/*
JWT:THIS DAEMON PGM WATCHES THE KEYBOARD FOR PRESSES OF THE SPECIAL HP ELITEBOOK 8440P "TOGGLE-KEYPAD" KEY WHICH X (xev, xbindkey & FRIENDS REFUSE TO SEE AFTER THE 1ST PRESS PER REBOOT) AND INVOKES THE COMMAND TO TOGGLE THE TOUCHPAD (AS IT WAS DESIGNED TO DO). X DOESNPT LIKE THIS SPECIAL KEY B/C IT ONLY SENDS A "KeyPressed" EVENT W/NO CORRESPONDING "KeyReleased" EVENT. IT WORKS LIKE OTHER "LED"DED KEYS SUCH AS CAPSLOCK AND NUMLOCK! THE INITIAL STATE IS "BLUE" (TOUCHPAD ON), FIRST PRESS SENDS KEYCODE 140 (148 TO xbindkeys) AND SWITCHES THE LED TO "ORANGE". NEXT PRESS SENDS KEYCODE 138 (146) AND SWITCHES THE LED BACK TO "BLUE". SUBSEQUENT KEYPRESSES ALTERNATE BETWEEN THESE TWO STATES. I STOLE THIS PGM. FROM HERE: http://stackoverflow.com/questions/20943322/accessing-keys-from-linux-input-device.  I MODIFIED IT TO ONLY CARE A/B THESE TWO KEYCODES. NOTE: I HAD TO ADD "setkeycodes e058 140" TO rc_local.pl WHEREAS THE OTHER ONE (138) WAS ALREADY RECOGNIZED BY THE KERNEL. THIS PROGRAM SHOULD BE STARTED THE FIRST TIME YOUR WINDOWMANAGER STARTS UP (.afterstep/autoexec in my case)
*/

int main(void) {
    const char *dev = "/dev/input/event0"; /* or whatever your keyboard input is */
    struct input_event ev;
    ssize_t n;
    int fd;

    fd = open(dev, O_RDONLY);
    if (fd == -1) {
        fprintf(stderr, "Cannot open %s: %s.\n", dev, strerror(errno));
        return EXIT_FAILURE;
    }
    while (1) {
        n = read(fd, &ev, sizeof ev);
        if (n == (ssize_t)-1) {
            if (errno == EINTR)
             continue;
            else
             break;
        } else
        if (n != sizeof ev) {
            errno = EIO;
            break;
        }
        if (ev.type == EV_KEY && ev.value >= 0 && ev.value <= 2) {
            /* printf("0x%04x (%d)\n", (int)ev.code, (int)ev.code); */
            if ((int)ev.code == 138) {
                /* TURN ON TOUCHPAD: */
                /* printf("--138: turn touchpad ON!\n"); */
                system ("/usr/bin/synclient TouchpadOff=0");
            } else if ((int)ev.code == 140) {
                /* TURN OFF TOUCHPAD: */
                /* printf("--140: turn touchpad off!\n"); */
                system ("/usr/bin/synclient TouchpadOff=1");
            }
        }
    }
    fflush(stdout);
    fprintf(stderr, "%s.\n", strerror(errno));
    return 0;
}

Now, when you press this “key”, it should turn orange and actually disable your touchpad, a second press should turn it back blue and re-enable your touchpad.  I believe you could add the “/usr/bin/synclient TouchpadOff=1” in your X session startup script above where you start this daemon, and reverse the two “TouchpadOff=#” commands in it to have it start out disabled, then toggle to enabled, then disabled, etc.
%d bloggers like this: