2 Mar2015

I wanted to use a Logitech R400 that a friend loaned my in a presentation, but I wanted to tweak the mappings for the buttons a bit. My presentation is done using Reveal.js and uses both left/right and up/down. The R400 has four buttons but two of them are mapped to “go to black screen” and “slideshow mode” neither of which is useful to me. Here is how I fixed it in Fedora 20.

Create the directory /etc/udev/hwdb.d

Write the following out to /etc/udev/hwdb.d/99-logitech-r400.hwdb

# The lower left button actually emits two
# different scancodes depending on the state of
# the "presentation".
# E.g. one code to start and one to stop.
keyboard:usb:v046DpC538
KEYBOARD_KEY_70029=up
KEYBOARD_KEY_7003E=up
KEYBOARD_KEY_70037=down
KEYBOARD_KEY_7004B=left
KEYBOARD_KEY_7004E=right

This maps the left and right buttons to left and right, the both states of the slideshow button to up, and the blank screen button to down. The 046D is the Logitech vendor code and the C538 is the model number. Those magic numbers after “KEYBOARD_KEY” are the scancodes associated with the button. Supposedly showkey --scancodes will display them but I couldn’t get that to work and ended up taking them from another blog post.

Virtual Disk Guide

Interested in virtualization? Do QCOWs rule your filesystem? Are you a libvirt or KVM+QEMU wizard? I wrote a book about virtual disk management. Check out the The Linux Sysadmin's Guide to Virtual Disks online for free at ScribesGuides.com.

Consider supporting the author by purchasing a hard copy of the first edition for just $10.00 on Lulu.com.

bitmath

bitmath is a Python library for dealing with file size units (GiB's, kB's, etc) in a sane way. bitmath supports arithmetic, rich comparison, conversion, automatic best human-readable representation, and many otherutility functions. Read some examples on the docs site or check out the source on GitHub.