Making Asus UX305CA touchpad work in Ubuntu (temporary fix!)

Hello everyone – I acquired a fine Asus UX305C “ultrabook” but I was somewhat disappointed to find that its touchpad, the ELAN1000, doesn’t work under Ubuntu.

A bit of Googling taught me that this is a widespread problem. It seems to come down to a bug in the i2c driver, and relating to some timing delay not being respected. It’s likely also to get fixed in the major next Linux kernel (4.5), but I don’t know when that one will come along. Anyway, as you can hear from the way I talk about it I have no clue what the actual problem is, but I found Kevin Fenzi’s fix here (and thanks to Benjamin Tissoires for pointing me to it):

https://bugzilla.redhat.com/show_bug.cgi?id=1275718#c7

The problem is at the above link it’s only explained how to do this for Fedora. Here I’ll show how to do this under Ubuntu.

This is a workaround – it’s not a real fix. The problem is expected to be actually solved in the 4.5 kernel but for the time being, you can use the instructions here as a workaround.

First, get ready to download, build and install a custom kernel. This is nowhere near as scary as it sounds. Follow the instructions here:

https://wiki.ubuntu.com/KernelTeam/GitKernelBuild

It may be a wise idea to test that you can get this custom kernel compiled, installed and running using the instructions above. It won’t actually solve your problem but once you manage to, you’re almost there.

Now in the kernel sources that you downloaded in the above tutorial, open the file

drivers/i2c/busses/i2c-designware-platdrv.c

In this file, find the following section:

static int dw_i2c_acpi_configure(struct platform_device *pdev)
        dw_i2c_acpi_params(pdev, "SSCN", &dev->ss_hcnt, &dev->ss_lcnt, NULL);
        dw_i2c_acpi_params(pdev, "FMCN", &dev->fs_hcnt, &dev->fs_lcnt,
                           &dev->sda_hold_time);
 
        return 0;
 }

Depending on the source you downloaded, there may be some extra lines before the return statement, but that’s irrelevant. Now after the two lines that start with dw_i2c_acpi_params, add the following line:

dev->sda_hold_time = 30;

When this is done, save the file. Now you just need to recompile the kernel sources and install them as explained in the kernel building tutorial, and then boot into the new kernel, and voilà, your touchpad should work. Booting into the new kernel is fairly easy: if you followed the steps in the tutorial then it should appear in your boot menu.

Confirmed to work for XUbuntu 15.10 on UX305.

Faema Family Grinder – When the adjustment is stuck

I wanted to share some of my experiences taking apart the Faema Family grinder. When I got it second-hand, I did not manage to adjust the grind. Normally you can turn the plastic bean hopper left or right to adjust the grind coarseness.

IMG_8438

So here I’ll jot down what I did hoping that it may help somebody in the future with a similar problem.

I took off the lid from the bean hopper and undid the three screws, taking out the little black cap shown in the picture below:

IMG_8439

Now the trick came. Below this hopper, I found the burrs that do the actual grinding. These are two metal elements on top of one another. In the following picture you can see the top one. It is supposed to be able to turn to make the grind finer or coarser, or, if you keep making it coarser, the entire top burr will come off which is great for cleaning. The trick is that it turns the opposite way from how a usual screw works: to loosen it, you turn it clockwise. I have illustrated this in the following picture:

IMG_8440

Since these burrs were really stuck, I had to stick in a metal plate that had the right size and then use it as a kind of screwdriver. I got this idea from this forum, which I recommend to have a look at for further detail: http://www.planetcafe.fr/forums/viewtopic.php?f=5&t=3016

Then the burrs started coming apart and finally I could take the top burr out completely. Here is what that looked like:

IMG_8441

Then it was a matter of lots and lots of cleaning and putting it together, and lo and behold, the grinder adjustment mechanism is fully functional again!

Rawstudio photo editing app on Ubuntu 15

Rawstudio is a great app for editing your RAW photos on Linux. However, its home site rawstudio.org seems to be offline these days. You can still get the program from github at: https://github.com/rawstudio/rawstudio

The program doesn’t seem to be available for Ubuntu 15 on PPAs yet so you’ll need to compile it yourself. Grab the code from the repository above, put it somewhere on your computer. You will probably need to install some packages. For me, I had to install some dependencies using the following command (you can run this in the terminal):


sudo apt-get install libtool libtool-bin libgtk-3-dev libgconf2-dev liblensfun-dev \
liblcms2-dev libexiv2-dev libfftw3-dev enfuse libtiff5-dev libxml2-dev sqlite3 \
sqlite3-dev libsqlite3-dev libgphoto2-dev

Then, go to the directory where you extracted the Rawstudio github source code, and run:


./autogen.sh

If you’re lucky and no errors are shown, you can proceed with:

make

cd src

./rawstudio

And that should do it! Hope this is helpful.

Hooking up a MIDI keyboard to Ubuntu

I have a MIDI-capable keyboard and a MIDI-to-USB converter. Today it finally worked under Ubuntu Linux. The MIDI-to-USB converter was quite cheap and no-name, but in case this is of help for anyone, the vendor ID was: VF-21-USB-MIDI-KYBD-CBLE-A43

From Linux, the usb device looks as follows (type lsusb in the terminal to get this info):

Bus 002 Device 004: ID 1a86:752d QinHeng Electronics CH345 MIDI adapter

If you plug it in, it pretty much works straight out of the box. Here is the dmesg output:

[ 582.546409] usb 2-1.3: USB disconnect, device number 3
[ 613.878085] usb 2-1.3: new full-speed USB device number 4 using ehci-pci
[ 613.971701] usb 2-1.3: New USB device found, idVendor=1a86, idProduct=752d
[ 613.971709] usb 2-1.3: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[ 613.971714] usb 2-1.3: Product: USB2.0-MIDI

For me, this creates a device node under /dev/snd/midiC1D0 (but the exact name might depend on other MIDI-capable devices present in your system, so simply look in /dev/snd/ to see what devices appear or disappear when you plug or unplug the USB cable). This device can then be read by Jack and hooked up to Fluidsynth or Rosegarden for your MIDI enjoyment!

Installing FTAP for finger tapping synchronisation experiments (OR: How to use FTAP in the 21st century)

Steve Finney made a neat Linux program for running sensorimotor synchronisation tapping experiments. In tapping experiments, you typically have a participant tap her or his finger along with a metronome. Finney’s program FTAP is a C-based program that will read the taps from a MIDI interface and that can generate metronome sounds. However, the program was developed in the early 2000s and the Linux landscape has changed somewhat. These days I’m installing FTAP on my friend’s Linux box. I figured the world might learn something from our errors.

First of all, make sure you start with a 32-bit version of Linux. It seemed to us that the binaries (pre-compiled executables) that come with FTAP don’t work under 64-bit Linux (which nowadays is the standard). When you download FTAP it should come with source code, which should allow you to compile it, but this didn’t work out of the box for us. Also, it should be possible to run the 32-bit FTAP executables in 64-bit Linux but we were too lazy to figure out how. So make your life easy and install 32-bit Linux.

Second, install a realtime Linux kernel. Current Linux versions by default have a kernel that allows you to come close to real time (called lowlatency) but I got the impression that for the very best timing performance you need the kernels called “realtime” which you can get from abogani’s PPA archive. Note that this works for Ubuntu 12.04 but maybe not for newer versions. For details:

http://www.ubuntubuzz.com/2012/03/real-time-linux-installation-on-ubuntu.html

https://help.ubuntu.com/community/UbuntuStudio/RealTimeKernel

http://askubuntu.com/questions/72964/how-can-i-install-a-realtime-kernel

Third, download FTAP: http://csml.som.ohio-state.edu/ftap/ Extract it and you should be ready to roll! Note that FTAP can only read the MIDI device /dev/midi. So if your MIDI device somehow gets mapped to another device node, make sure you install a symbolic link in /dev/midi to the actual device node.

A final note (please learn from our stupidity): When we ran FTAP on a particular day, we found incredible delays (up to several seconds) between the MIDI input and MIDI output. These delays persisted when FTAP wasn’t even running, and the computer was set up (using aconnect) to immediately forward the MIDI signal back to the USB-MIDI device. It turned out to be due to the fact that Windows (which was also installed on the computer in a dual-boot set up) had not been shut down but was in hibernation mode. Apparently this meant that Windows was still using resources and this caused massive delays in the MIDI processing. Lesson learned: don’t hibernate Windows while you are running an experiment under Ubuntu!

One-trick “Oh Hell” – what are you chances of winning?

On a holiday day Meaghan Fowlie and I decided to figure out your chances of winning in a one-trick “Oh Hell” game. “Oh Hell” is a variant to the Whist game; if you want to know the rules in more detail, check out the Wikipedia page.

So let’s assume that there is only one trick to play (each player has one card). Trumps are decided by a card that is flipped face up (so we know that is one less card in the trump suit in the game). What are the chances that you’ll win this trick? It depends of course on which of the following situations you are in:

– You don’t have a trump, but you are leading (you are the first to play). This is marked as nontrump.leading in the graph below.

– You don’t have a trump, and you are not leading. This is marked as nontrump.not.leading.

– You have a trump. Furthermore, it is higher than the card that is turned face up. This is called trump.turned.card.below.

– You have a trump, and it is lower than the card that is turned face up. This is called trump.turned.card.above.

If you’ve decided what case you are in, you can use the graph below to decide how likely you are to win the trick. The horizontal panels indicate the number of players (between 2 and 6). The x-axis indicates the card you hold. The lines indicate the probability that you’ll win. So if you play “optimally”, you’d bid 1 if the chance is greater than 0.5 and 0 otherwise.

 

ohell_have_trump

Of course, this is true only if you have no other information. Once other players place their bids, your estimation of your chances of winning should change. Maybe we’ll address this some other holiday day.