Obelisk: A Monitor Review

I’ve had the same monitor in my stereo control system for many years. It’s a 20″ Dell that’s OK.

It’s got an appropriate size for the living room. But lately it’s started having a high-pitched whine. If I play only punk music I can’t hear it at all, but otherwise it’s slightly annoying.

So I went looking for a new monitor. I thought it might be nice to have a rotated monitor this time: Higher than wide so that I can display the name of the currently playing artist un-sideways.

Practical as always.

So my specs here were: No logos, and no bezels wider on any sides, and as small as possible. The logo/bezel thing because inevitably that looks weird when rotated, and this is in the living room. Looking pretty is nice.

Behold! After searching for hours, there was one (1) monitor that fit the specs, and it’s this 24″ NEC EX241UN. It’s got very narrow bezels and no logos and nothing ugly. So it’s just like a matte obelisk.

But my stereo computer machine is oooold. It’s based on a 2GHz Pentium M 32-bit CPU. I think I bought it in 2005, possibly? You can see it underneath the cassette player up there… It’s in a Hush enclosure.

And it managed to connect to the screen! I wasn’t quite sure whether it was going to be able to do that, because it’s also a Pentium M motherboard and the video routing is not very well supported by Linux by default. But I managed to route the DVI signal out instead of the LVDS and VGA, and there’s … the Matrix?

Er. X isn’t quite sure….

OK, “Option rotate left” in xorg.conf instead.

Now I have to rearrange all the display data… Hm… Does that look nice?

The monitor itself is pretty nice.  Quite wide viewing angle, but when I standing there at the screen looking for something to play, I do get a slight sheen at the bottom of the screen, so it’s not perfect.  But it’s completely silent, as far as I can tell over my tinnitus.

Perhaps I should have a clock and a load monitor there. Just so that not 100% of the screen is Emacs. I don’t want to appear fanatical or anything.

Or perhaps the sleeve on top?

Hm… Perhaps I should make that font smaller. I’m nearsighted, but not actually blind.

The un-nerdiness of this setup cannot be misunderstimated.

Of course not.  Not.

Automatically Mount exfat File Systems in Linux

I do quite a bit of video on my camera, and the easiest way to transfer these rather large files to my computer is to insert the SD card into an SD card connected to my computer.

impossibleI wanted this to be as painless as possible, so I want the computer to auto mount anything inserted, without any distracting GUI stuff popping up.

The usbmount package was suggested, and it almost works. After inserting a card into the reader, it mounts it… but then three seconds later the mount point goes AWOL. If I df, I get this message:

# df
 df: ‘/media/usb1’: Transport endpoint is not connected

And it turns out that this is more complicated than you’d think, because udev and systemd.

The file system on the cards I use is exfat. exfat is a fuse (userland) file system, so usbmount ends up starting a userland process to handle the file system.

And you can’t do that from udev. It does not allow “long lived processes”: It’ll kill off everything started by an udev rule, and that includes the fuse process.

So now what?

It turns out that there is no easy way to do something as trivial as automatically mount an exfat SD card. But there’s a fiddly and yucky way, involving systemd units and other stuff that no sane person should feel necessary to know about, so I’ve created a little package for you with some files that you can just copy to the correct locations, and it’ll Just Work.

gladFor the next two weeks, until the udev/systemd brain trust fucks us all over again.

I’ve tested these files on Debian Jessie in mid July 2016, and it worked then.  Your mileage will vary.  I’ve cobbled this together by Googling for hours and mashing up various recipies that almost work.  Neither udev nor systemd are very good at reporting errors, so it’s all trial and error…

Down the Rabbit Hole

Aaargh!

I was going to do a simple switcharoo.  The tiny firewall machine at home had shown itself to be slightly unstable.  Not egregiously, but it seems like it’ll die every four months or so.  That’s kinda annoying.

_1310382
Fitlet X-Lan all wired up

So I got a new, spiffier tiny machine.  Copying over the setup from the old machine should take five minutes.  At most.  But then I started thinking.

WARNING!  THERE IS NOTHING OF INTEREST IN THE REST OF THE BLOG POST UNLESS YOU”RE INTO EXTREME LINUX B&D!!!1!

This is what I thought: “This machine has a better CPU and graphics card than the machine I’m currently using as the music RAID/music ripping/charging headphones/scanning machine.  Perhaps I should just make this a firewall/RAID/music/charging/scanning machine and have one fewer machines at home?”

_1310392
The old RAID machine

You can see where this is going.

Three six hour days later, things are kinda starting to work.

I think the base problem is that I’ve got a mixed setup of newer stuff and older, not very well supported stuff that was unusual even back then.

Here’s the lsusb output:

root@potato:~# lsusb
Bus 004 Device 004: ID 1781:0c30 Multiple Vendors Telldus TellStick
Bus 004 Device 003: ID 041e:30c4 Creative Technology, Ltd 
Bus 004 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 004: ID 0409:005a NEC Corp. HighSpeed Hub
Bus 003 Device 003: ID 0bda:8723 Realtek Semiconductor Corp. 
Bus 003 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 005: ID 0bc2:3320 Seagate RSS LLC SRD00F2 [Expansion Desktop Drive]
Bus 002 Device 004: ID 0bc2:ab31 Seagate RSS LLC 
Bus 002 Device 003: ID 059f:106e LaCie, Ltd 
Bus 002 Device 002: ID 05e3:0612 Genesys Logic, Inc. 
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 008: ID 0eef:0001 D-WAV Scientific Co., Ltd eGalax TouchScreen
Bus 001 Device 007: ID 17e9:0288 DisplayLink 
Bus 001 Device 006: ID 0a81:0205 Chesen Electronics Corp. PS/2 Keyboard+Mouse Adapter
Bus 001 Device 005: ID 0409:005a NEC Corp. HighSpeed Hub
Bus 001 Device 004: ID 080c:0300 Datalogic S.p.A. Gryphon D120 Barcode Scanner
Bus 001 Device 003: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
Bus 001 Device 002: ID 04b8:0129 Seiko Epson Corp. ES-10000G [Expression 10000XL]
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Yeah, I know.  In addition there’s two eSATA CD-ROMs and the internal SSD.

First of all, this machine is quite picky about what USB hubs it’ll accept.  I’ve got three USB3 hard disks (that make up the /music RAID) connected via a USB3 hub, because there’s only two USB3 connectors on this machine.  With the first hub I tried, Linux was unable to detect the disks.  Unless I plugged them in one at a time.  My guess would be a power management problem.  With a different, cheap powered USB3 hub, everything works fine.

For the non-USB3 things I had a different powered hub, and when that was plugged in, the BIOS wouldn’t boot.  Fortunately there’s six USB2 sockets, so I was able to connect most of the things directly, and it seems to accept having the headphones etc connected via a cheap unpowered small hub, as seen here:

_1310381
New spiffy machine

After getting all the USB power situation figured out (which took a while), I started checking the individual devices.  Most things just worked (like the USB speaker, the Epson USB scanner, the eSATA CD-ROMs, Tellstick, the Datalogic barcode scanner…), but the USB monitor (Mimo Monztor 10″) refused to switch to monitor mode.

It comes up in CD-ROM mode (with some installation software), and you’re supposed to run usb_modeswitch on it to switch it to the udlfb mode.

USB description data (for identification)
-------------------------
Manufacturer: DisplayLink
 Product: Monztor S10
 Serial No.: 10270020
-------------------------
Change configuration to 1 ...
 Device is busy, try to detach kernel driver
Looking for active driver ...
 OK, driver detached
 Device is busy, try to detach kernel driver
Looking for active driver ...
 No active driver found. Detached before or never attached
 Device is busy, try to detach kernel driver
Looking for active driver ...
 No active driver found. Detached before or never attached
 Device is busy, try to detach kernel driver

Hm.  Busy?  I guess, because the usb-storage driver claims it.  So then I thought: Could I make usb-storage not do that?  I can’t disable usb-storage, since I need that for the /music RAID, but can I make usb-storage hand it over?  Indeed I can.  This is my solution:

First, make Linux identify the “disk” by giving it a name:

root@potato:~# cat /etc/udev/rules.d/20-monztor.rules
SUBSYSTEM=="block", ATTRS{idVendor}=="17e9", ATTRS{idProduct}=="0288",
   MODE="0666", SYMLINK+="monztor"

Then I use the following script:

#!/bin/bash

device=$(basename $(realpath /dev/monztor))

for file in /dev/disk/by-path/*; do
    candidate=$(basename $(realpath "$file"))
    if [ "$candidate" == "$device" ]; then
	id=$(echo "$file" | sed 's/.*usb-[^:]*://' | sed 's/-.*//')
	for uid in /sys/bus/usb/drivers/usb-storage/*; do
	    suid=$(basename $uid | sed 's/^..//')
	    if [ "$suid" == "$id" ]; then
		result=$(basename $uid)
	    fi
	done
    fi
done

echo $result

Then I start X this way:

root@potato:~# cat /etc/init.d/xinit
#!/bin/sh


case "$1" in
start)  echo -n "Starting display"
        if true; then
	    rmmod udlfb
	    sleep 10
	    /root/find-monztor > /sys/bus/usb/drivers/usb-storage/unbind
	    sleep 2
            modprobe udlfb fb_defio=1 console=1
            sleep 5
            usb_modeswitch -v 0x17e9 -p 0x0288 -u 1
            sleep 1
            /usr/bin/X :1 -depth 16 -xf86config /etc/X11/xorg.conf.mimo -sharevts -noreset -s 0  &
        fi
        su - larsi -c "xinit -- /usr/bin/X :0 -depth 24 &"
        echo "." 
        ;;
esac

Yeah, look at all them sleeps…  This is all kinda timing sensitive, but with these very generous pauses between each action, the boot is 100% reproducible.  But it should be done in a less hacky way, of course, but whatevs.

Now, you’d think, everything is hunky dory?

What’s going on with the mouse pointer?  It just stands there, shaking…

And then it occurred to me that the Monztor monitor is a touch monitor, and perhaps it doesn’t…  really work with a modern version of Linux?  This is what xinput –list says:

⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ CHESEN PS2 to USB Converter             	id=11	[slave  pointer  (2)]
⎜   ↳ eGalax Inc. USB TouchController         	id=13	[slave  pointer  (2)]
⎜   ↳ eGalax Inc. USB TouchController         	id=12	[slave  pointer  (2)]
⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
    ↳ Power Button                            	id=6	[slave  keyboard (3)]
    ↳ Video Bus                               	id=7	[slave  keyboard (3)]
    ↳ Power Button                            	id=8	[slave  keyboard (3)]
    ↳ CHESEN PS2 to USB Converter             	id=10	[slave  keyboard (3)]
    ↳ Creative Technology Sound BlasterAxx SBX 8	id=14	[slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard            	id=15	[slave  keyboard (3)]
∼ © Datalogic 2002 Datalogic Bar Code Scanner	id=9	[floating slave]

Yup, there it is.  The eGalax thing has to be the Monztor.  So how to disable that?  The xinput command can do all sorts of things, but it’s not very user friendly.  I made the following little command that’ll output device IDs based on regexp matches:

#!/bin/bash

match="$1"

if [ "$match" = "" ]; then
    echo "Usage: $0 "
    exit
fi

xinput --list | grep "$match" | sed 's/.*id=\([0-9]*\).*/\1/'

And then I can say things like

# Disable input from the Mimo monitor touch screen, because it's
# buggy and shivering.
for id in `xlist eGalax.*pointer`; do
    xinput set-int-prop $id "Device Enabled" 8 0
done

Presto! No shaking! But then I noticed that whenever I did something on the main screen, the events were also passed to the second X server running an mplayer showing random youtube clips.
And xinput doesn’t take a –display parameter. This is how I disable that:

# Disable all pointers and keyboards on the other screen
xterm -display :1 -e \
 'for id in `xlist .`; do xinput set-int-prop $id "Device Enabled" 8 0; done'

See? SIMPLE!!!

But now the little monitor is showing the temperature and a youtube clip vaguely of the same thing that my stereo is playing.  Back to normal.

So does Linux suck?  Of course.  But I’m making it do some pretty weird stuff, and I’m kinda surprised this all works at all.  My guess is that on any other OS using this range of obscure hardware, this would have been just as awful.  Although perhaps I wouldn’t even have attempted it.

And I just had to rebuild the RAID two or three times during this process.  I mean, c’mon.

Touchy Emacs

I use Emacs as a music playing interface, and I thought it would be nice try to create a pure touch screen interface, just … because.

The only OS that would install on my old Surface Pro 2 was the prerelease version of Ubuntu 16.04, Xenial Xerus.  Apparently kernels between 2013 and a couple of weeks ago dropped support for the wifi card in the Pro 2, so, but Xerus has it.

And everything works fine.  Except the multitouch.  Apparently Unity only has support for four-digit gestures, and it’s apparently impossible to remap these gestures.  (This is what hours of googling told me.)

To make Unity stop doing this crap, you have to build your own version.  This page explains how, but I’m just going to reiterate what it says, because some things have changed slightly.

sudo apt-get build-dep unity
cd /tmp
mkdir unity
cd unity
apt-get source unity

Then edit this file:

unity-7.4.0+16.04.20151218/plugins/unityshell/src/unityshell.cpp.  Comment out this line

//InitGesturesSupport();

And then build.

cd /tmp/unity/unity-6.8.0
dpkg-buildpackage -us -uc -nc
cd ..
sudo dpkg -i *.deb
apt-get remove unity-autopilo

Then install touchegg.  You need to create mappings between gestures and the events that Emacs will respond to.

<touchégg>
 
 <settings>
 <property name="composed_gestures_time">0</property>
 </settings>
 
 <application name="Emacs">

 <gesture type="TAP" fingers="2" direction="">
 <action type="SEND_KEYS">space</action>
 </gesture>
 
 <gesture type="TAP" fingers="3" direction="">
 <action type="SEND_KEYS">p</action>
 </gesture>
 
 <gesture type="DRAG" fingers="2" direction="UP">
 <action type="SEND_KEYS">Control+v</action>
 </gesture>

 <gesture type="DRAG" fingers="2" direction="DOWN">
 <action type="SEND_KEYS">Alt+v</action>
 </gesture>
 </application>

</touchégg>

Etc etc.  And here’s the result: A Surface Pro 2 playing in the kitchen while I’m programming on the patio:

I kinda really wanted to delve into creating a proper touch interface for Emacs, where you could define gestures as you want with a simple (local-set-key [(swipe up three-fingers]) ‘do-something), but this stuff seems like it’s way immature.  Still.  After all these years.  Or perhaps I’ve just not found the right documentation on dar webs.

Useful Consumer Review

I’m travelling next month, so I thought it would be nice to have a really lightweight disk to carry movies around with. On. In. After. Under. <PREPOSITION>.

So I got this rather spiffy-looking USB3 SSD:

_1310154It shows up in Linux as

[30759.597367] scsi 2:0:0:0: Direct-Access Samsung Portable SSD T1 0 PQ: 0 ANSI: 6
 

but tells the OS that it’s a CD-ROM.  Nobody has written a usb_modeswitch script for it, so the only way to make it work is to insert it into a Windows machine, click through the installer (disabling the encryption), and then it’ll show up as a mass storage device the next time you plug it in.

That’s rather annoying.

It is really lightweight:

_131015226 grams.  But what about that USB cable?

_131015312 grams.  So you basically increase its weight by 40% if you want to use it…

Otherwise, it seems fine.  It’s quite snappy.  I get read speeds of 360 MB/s when accessing large files on an ext4 file system, which is way way way more than you need to watch films…

Useful Consumer Review

I have several small USB-powered monitors for various things. They’re all from Mimo Monitors, and they work very well. Haven’t had a problem with any of them over the years.

The only problem is that the displays suck. The viewing angle is horrible on them, and the contrast is worse than you can imagine. That is, the black bits of the monitors are very grey.

This is a major problem on the 10″ one I use at the alarm clock in the bedroom:

_1310126
That’s very much how it looks like in real life. It’s slightly exaggerated by the camera.
_1310127
With the door closed and all lights off, the screen is a major source of light.
_1310129
And the viewing angle is so bad that I have to sit up in bed to be able to read the alarm time.

But now Mimo has released a new batch of monitors.  Mimo Vue.  That are supposed to be, like, good.  IPS screens and everything.  So I ordered one, and it came today.  I unpacked it excitedly…

_1310124Only to find a large … blob … in the middle of the screen.  I thought it was probably completely ruined, but I fired it up, anyway.  And it works!

_1310130
If you compare with the first picture up there, you can see that the black levels are way, way better.
_1310133
End the viewing angle is better, too.

So, it’s better.  The camera exaggerates how much light it gives off, but it’s still not what you’d call “good”.  The black bits still aren’t particularly black.  It’s much better than the older models (and the resolution is higher), but it’s not sufficiently good for me to run out and replace all my screens.

I guess I’ll have to wait for somebody else to get in on the USB-powered screen game…  It’s just so convenient to have one single cable to the screen.  No fuss, no muss.

And, yes, the Mimo Vue monitor worked in Linux without any twiddling.  Just plug it in and point X in the direction of /dev/fb0.

Linux, Wifi Hardware and Tethering

I thought it might be convenient to set up the laptop as a wifi access point sometimes (especially when copying images off of the Flashair SD card in the cameras, since they have very short range).

There’s apparently no built-in method in any Linux distribution to have a wifi card be both an AP and a client at the same time.  This is probably because it’s a very complicated task depending on lots of hardware and software details.  But someone has taken a stab at it, anyway.

On my new Lenovo Carbon X1 laptop, with this wifi controller

04:00.0 Network controller: Intel Corporation Wireless 7265 (rev 59)

it doesn’t work.  If NetworkManager is running, it just says “Device busy” when creating the ap0 device.  If I stop NetworkManager, I’m able to create the AP, but if I then start NetworkManager, it’s unable to connect to the real AP.

On my old Lenovo Carbon X1 laptop, with this wifi controller

03:00.0 Network controller: Intel Corporation Centrino Advanced-N 
        6205 [Taylor Peak] (rev 96)

it works!  And it’s much, much faster copying pictures from the Flashair card when it talks directly to the laptop than copying pictures via a separate AP.  Which makes sense, but I didn’t think it would be like 5x faster…

Looking at “iw list” on both, they both seem to claim that they should be able to be a client and an AP.

Does anybody have an idea whether the newer chipset just isn’t capable, anyway?