Anyone use the Mopidy Touchscreen Front end?

Hi Im new to PI Music Box ans wanted to add a touchscreen to it. I have installed the touchscreen and I know it is working. I then installed the extension and added the configuration in the file per

When I start Mopidy nothing happens on the screen. Mopidy config shows that it loaded the configuration and when I start it verbose it shows it loaded the extension.

I’m using pi-musicbox version .5

Any help would be appreciated.

I have not tried to use it with musicbox.
I will try to install it on musicbox to see what is the problem.
What display are you using? Or simply you want to see it from HDMI?


I am using the adafruit PiTFT screen.


Hi MattR,

I have the same set-up with the same touchscreen, but additionally with an Hifiberry DAC.
I had the same issue as you and was able to resolve at least the issue with the touchscreen and get that one working. I did however do this under Raspbian in the end since I wasn’t able to get it done under musicbox (you might want to try this under musicbox though - probably you can get it done).
If you want to try with musicbox, you might need to enable ssh first or get yourself access to a console.

Here is what I figured out with a lot of support by @9and3r

First get yourself to be root - keeps you from having to type “sudo …” all the time, and aparently the extension of 9and3r only works with root priviledges anyway. Would therefore start this way:
log in with the normal user

    sudo passwd root
    <type your pass, hit enter x2>
--> now you're root and can login as root next time

First get the touchscreen working under the console. To do so, follow this tutorial:

In the file /etc/modprobe.d/pitft.conf I changed he line “rotate” to 90.

When this is all done, I would follow the tutorial from Adafruit of this page, but only the part above the “automagic calibration”:

Then do the manual calibration from the same page (after the automagic calibration part). Skip the X Calibration as you won’t need it.

If you want the bootmessages to show on the screen, follow this portion of the howto:

The last hint on the same page you should follow even if you don’t want to see the bootmessages. (set screen blank time to indefinite to not let it turn off automatically)

Add this to your /etc/profile:


Now you need to apply some changes to the plugin to pipe the output to the touchscreen and to ensure the touchscreen calibration gets applied / saved:

Now, change the following file: /root/mopidy-touchscreen/mopidy-touchscreen/
BEFORE it says “pygame.init()” (somewhere around line 28) add the following 4 lines:

os.environ['SDL_VIDEODRIVER'] = 'fbcon'
os.environ["SDL_FBDEV"] = "/dev/fb1"
os.environ["SDL_MOUSEDEV"] = "/dev/input/touchscreen"
os.environ["SDL_MOUSEDRV"] = "TSLIB"

Now you need to save this and go back to the folder /root/mopidy-touchscreen. There you install this changed version of the plugin - in the folder, type:

python install develop

When this is done, I would reboot once more - and try to run mopidy as user root. Either by editing the file /etc/init.d/mopidy … and changing the user and group definitions in there, or even better since you can watch the output on the console, directly as root:


If you want to get more debug info to look at things, you can add “-v” (-vv and -vvv also works for even more info).
The first time you run it directly, it will create a new config file under the root folder under /root/.config/mopidy/mopidy.conf and exit. The mopidy version run directly will not know about the file under /etc/mopidy/…, so ensure you got the right config in there.

When you start it up, the console should show on your screen. At least with Raspbian it now always does it for me (reinstalled a couple of times as per method above). With MusicBox I did not get it working.

When I run the touchscreen however, I still run into the issue that GStreamer does not want to play my music any longer:

This is not yet resolved for me - in case anyone could help me fix this, I would greatly appreciate this.

Hope this helped to point you into the right directions.

@woutervanwijk : is there any chance we could get the mopidy-touchscreen plugin working under musicbox?
This would be THE really perfect solution.

Thanks for the info I’ll give it a try. I did use those exact instructions to get the screen to work so I’ll take a look at modifying the python file.

I have been trying to make it work with musicbox.
I could not make the extension load at boot. I have no idea what is happening. Anyone knows how does boot work in musicbox and where can I see the full log of mopidy?
If I start mopidy from the command line (mopidy -vv) the extension is working correctly, HDMI or TFT display.
Maybe @woutervanwijk can give some advice.
Thank in advance.


I am at the same spot you are now. If I run it form the command line as root it works, but as a daemon at start up.

ok Actually take that back I got it to load at boot, however I have to see what the consequences are. It seems as though the extension does not like the user musicbox. In etc/rc6.d there is the bash script to run the daemon. This has the user as musicbox. I changed it to root and all is happy. (not shure what else will be broken at the moment though although tune-in works.

Why does your extension have to run as root? Is there file permission issues?

If it interfaces through the raspi GPIO pins it wouldn’t surprise me if this is done via /dev/mem - in which case you need to be root or have CAP_SYS_RAWIO (see man capabilities). Note that this is just a hunch as I have no idea how the setup is interfacing with screen.

Yes it is with the GPIO pins so that is a possibility.

Thanks MattR.

Changing the etc/rc6.d makes the extension work properly.
I am working in the next update to make the os.envirom details configurable from mopidy config (you can check preview on github) and I will update the readme.

The extension does not need to run with root for example in ubuntu. As @adamcik said is related with the display being connected to the GPIO.
There is also another reason to use root. (Shutdown and Restart options). But these are totally optional and they will simply not work if we have not permission.

Sounds as if there is a way to get this working under musicbox then.

Does your sound work, too?
Did you get it working with lower permissions than root?

Could you comment in more detail which steps you had to take to get it running?
Reason I am asking is that this might be a way for me to fix my remaining issue:

Boot works just like normal Raspbian. I only added the /opt/ script to /erc/rc.local. Mopidy, upmpdcli and shairport are started by this script. The rest of the services are started normally.
Don’t know much about the touchscreen extension. I don’t have one. Would be a nice idea though. I’ll try to get it to boot without errors.
Mopidy runs as the user mopidy, not musicbox (it did in the old versions). Group is audio.
Did you find a reference to the old musicbox user?

Honestly, I would have to to a re-image to find out. The user could have been mopidy and I just had a typo. Check /etc/rc6.d/k02mopidy you will see the user


Change the User to root from whatever it was.


If we could get this one working out of musicbox, this would really be a unique value of musicbox + mopidy over all other systems I found.

I have reinstaled several times musicbox and I could not find a way to run touchscreen without root or sudo. I found out that it needs mopidy to be video group (/etc/group file). But this is not enough as I am getting other error.

Regarding not working Hifiberry DAC as I do not own one I can test it, but maybe pygame is taking full control of it even it will not use it.
I found that there are some variables related to audio that are set the same way we are doing with video.
Check audio variables here

Maybe you can output the pygame sound to a file.
os.environ[“SDL_AUDIODRIVER”] = “disk”

I have no idea if this it will work. It is only something you can try.

9and3r - I love you man! Solved the riddle again for me. Days of work and trying around - finally done.

added SDL_variables in your plugin, same place as the others:

os.environ["SDL_AUDIODRIVER"] = "disk"
os.environ["SDL_PATH_DSP"] = "/dev/null"

Everything working - made my day.

Hey guys may somebody help me? I installed musicbox and also the mopidy touchscreen and i added the following code to the mopidy config file:

enabled = true
screen_width = 320
screen_height = 240
cursor = True
fullscreen = False
cache_dir = $XDG_CACHE_DIR/mopidy/touchscreen
sdl_fbdev = /dev/fb1
sdl_mousedrv = TSLIB
sdl_mousedev = event0
os.environ[“SDL_AUDIODRIVER”] = "disk"
os.environ[“SDL_PATH_DSP”] = “/dev/null”

but after a reboot i got the following error:

touchscreen/os.environ[“sdl_audiodriver”] unknown config key
touchscreen/os.environ[“SDL_PATH_DSP”] unknown config key
touchscreen/sdl_fbdev = /dev/fb1 unknown config key
touchscreen/sdl_mousedrv = TSLIB unknown config key
touchscreen/sdl_mousedev = event0 unknown config key

What am I doing wrong? or What do I have to change to get it running?

The above two lines are not configuration settings for the extension. If you read the posts above they talk about other ways of settings those environment variables.

sdl_mousedrv should be sdl_mousdrv. The other two actually look fine. However, when there is an unknown config key the error message should not include the value the key is set to i.e, it should have just said “touchscreen/sdl_fbdev unknown config key”. This implies it’s the musicbox settings.ini parsing that is getting this wrong and interpreting the whole line as the key, maybe that’s due to the " characters in the os.environ stuff you tried to put in there? So, remove the os.environ lines and set those values some other way. Hopefully the other settings will then be recognised (but you technically don’t need to set any options unless you want a value different to the defaults.