Translate

Sunday 17 January 2016

Automount a USB media player in Linux

It is useful to be able to automount USB file systems when the USB device is plugged into your computer.

This is an example of automounting an mp3 player (Creative Zen xfi) running Rockbox in a Gentoo system.

I did this in 2 stages.

Since the device name of the mp3 player will vary (could be /dev/sdd1 /dev/sdf1 etc.) the first stage is to ensure the device name is always the same. This is a useful site with good examples of how to do this.  I created a file as shown on this site called /etc/udev/rules.d/65-stick.rules containing:

# # Rockbox device
KERNEL=="sd*", SUBSYSTEMS=="usb", ENV{ID_VENDOR}=="Rockbox", \ ENV{ID_SERIAL}=="Rockbox_Internal_Storage*", SYMLINK+="zen%n", GOTO="stick_end"
LABEL="stick_end"

This rule uses unique information about the device which you can gather through a couple of commands. First, dmesg, which in this case allows you to identify the device name. Here is an extract from the dmesg output:

[1203747.956962] usb 4-1: New USB device found, idVendor=041e, idProduct=4162
[1203747.956965] usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[1203747.956967] usb 4-1: Product: Rockbox media player
[1203747.956969] usb 4-1: Manufacturer: Rockbox.org
[...]
[1203748.988809] sd 243:0:0:1: [sdf] 31291392 512-byte logical blocks: (16.0 GB/14.9 GiB)
[1203748.992059] sd 243:0:0:0: [sdb] Write Protect is off
[1203748.992064] sd 243:0:0:0: [sdb] Mode Sense: 0b 00 00 08
[1203748.994794] sd 243:0:0:1: [sdf] Write Protect is off
[...]
[1203749.040790]  sdb: sdb1
[1203749.047790]  sdf: sdf1
[1203749.088771] sd 243:0:0:0: [sdb] Attached SCSI removable disk
[1203749.091768] sd 243:0:0:1: [sdf] Attached SCSI removable disk

From this I can tell that the device's internal drive is /dev/sdb1 and that the SD memory card in the device's memory slot is /dev/sdf1.

The command udevadm info /dev/sdb1 shows some further information about the device including the following lines: 


The ID_SERIAL and ID_VENDOR values are now used to uniquely identify the device in the udev rule shown above. 

The udev rule ensures that symoblic links is created for the Creative Zen device. The device names are always  zen and zen1.

The following command ensures that any new udev dule is active:

udevadm control --reload-rules

Now to autofs for which I found this Gentoo wiki page the most useful. I emerged autofs and then ensured it was enabled and started in systemd:

systemctl enable autofs.service
systemctl start autofs.service

Next I edited the /etc/autofs/auto.master file to include:

/media   /etc/autofs/auto.misc    --timeout=15 --ghost 

This means that the mount instructions in auto.misc will mean that the filesystem is mounted under /media.

My /etc/auto.misc has the following line:

zen          -fstype=vfat,rw,uid=1000,gid=100          :/dev/zen1

 This means that a mountpoint /media/zen will be created for the device /dev/zen1 and that the filesystem is writeable by the user. 

Monday 11 January 2016

Musescore 2.0 on Gentoo

Good to find out today that the development version of version 2.0 of Musescore compiles successfully on Gentoo using the instructions on this page.

I need to keep Qt4 on my system as it is quite old so I installed Qt5 into my home directory and set the path for Qt as described in the compile instructions. The nightly build I used from Git was 10 January. I followed the instructions to build a binary called mscore-self.

So far the new version has run without any issues and the new default soundfont is great, it transforms the playback of scores.    

Sunday 3 January 2016

Building the Polyphone soundfont editor on a Gentoo system

Polyphone is very useful soundfont editor. Version 1.7 compiled without any issues on my Gentoo system once I had edited the polyphone.pro file (one of the source files) and uncommented these lines (taking the initial hash out):

#DEFINES += USE_LOCAL_RTMIDI
#DEFINES += USE_LOCAL_STK
#DEFINES += USE_LOCAL_QCUSTOMPLOT

This stops qmake trying to find the relevant files in your main Gentoo library directories. As it says in the polyphone.pro file:

# Uncomment a line if your distribution doesn't come with some of the following libraries

It is possible to emerge rtmidi (one of the dependencies) from the Gentoo lorelei overlay but Polyphone's installation script still won't find it.

Using the process described here, you end up with a Polyphone binary which works fine.

The version of GCC used was i686-pc-linux-gnu-4.9.3.