Anyone use the Mopidy Touchscreen Front end?

Ye thx, I deleted those lines but the problem is the other ones with the unknown config key are here anymore and cause of this errors the extension is automatically disabled

Found touchscreen configuration errors, the extension has been automatically disabled:
touchscreen/sdl_fbdev = /dev/fb1 unknown config key
touchscreen/sdl_mousdrv = TSLIB unknown config key
touchscreen/sdl_mousedev = event0 unknown config key

I also mentioned you don’t have to include settings when they are the same
as the default, as yours appear to be. Perhaps musicbox settings parsing is
screwing these strings up, but I can’t see why.

Hi.
I think that you used pip to install the extension. The pip version is an old version without those config. That is why you are getting configuration errors.

To fix it uninstall that version and install it from git:
git clone https://github.com/9and3r/mopidy-touchscreen.git
cd mopidy-touchscreen
python setup.py install

As the configuration is the same as the default one you are not required to write it on the config file.
I hope you wont have any problem. If something goes wrong just let us know.

That makes a lot more sense. It’s also worth nothing you can install from github using pip: pip install https://github.com/9and3r/mopidy-touchscreen/archive/master.zip.

Hello,
i am trying to run the this touchscreen front end with a sainsmart32 (valdodov´s interface), using valdodov´s kernel and pimusicbox 0.6… The tft and touchscreen is working with another linux image.

after installing the image , i made an update and installed valdodov´s kernel. pimusicbox is running fine.

i used this thread to setup my system and this pip install https://github.com/9and3r/mopidy-touchscreen/archive/master.zip

the older version of pygame i had to install manually, because pip install did not find the right links …

sudo TSLIB_FBDEVICE=/dev/fb1 TSLIB_TSDEVICE=/dev/input/event0 ts_test is working

modipy config:
[touchscreen]
enabled = true
screen_width = 320
screen_height = 240
cursor = true
fullscreen = false
cache_dir = $XDG_CACHE_DIR/mopidy/touchscreen
gpio = false
gpio_left = 4
gpio_right = 27
gpio_up = 22
gpio_down = 23
gpio_enter = 24
sdl_fbdev = /dev/fb1
sdl_mousdrv = TSLIB
sdl_mousedev = event0
sdl_audiodriver = disk
sdl_path_dsp = /dev/null

when i start mopidy via ssh

i got this:
INFO Starting Mopidy 1.0.7
INFO Loading config from builtin defaults
INFO Loading config from /root/.config/mopidy/mopidy.conf
INFO Loading config from command line options
INFO Disabled extension spotify_tunigo: (pyspotify 2.0.0 (/usr/local/lib/pyt hon2.7/dist-packages), Requirement.parse(‘pyspotify<1.999,>=1.9’), set([‘mopidy- spotify’]))
INFO Disabled extension gmusic: (pyasn1 0.1.8 (/usr/local/lib/python2.7/dist -packages), Requirement.parse(‘pyasn1==0.1.7’), set([‘oauth2client’]))
INFO Disabled extension spotify: pyspotify<1.999,>=1.9 required, but found p yspotify 2.0.0 at /usr/local/lib/python2.7/dist-packages
INFO Enabled extensions: stream, podcast-gpodder, mpd, http-kuechenradio, so mafm, softwaremixer, moped, musicbox_webclient, websettings, tunein, mopify, pod cast-itunes, internetarchive, touchscreen, http, podcast, alsamixer, mobile, loc al-sqlite, youtube, simple-webclient, local-whoosh, m3u, audioaddict
INFO Disabled extensions: spotify, spotify_tunigo, gmusic, scrobbler, subson ic, dirble, local, soundcloud
WARNING Found dirble configuration errors, the extension has been automatically disabled:
…CUT

INFO Starting Mopidy frontends: QueueManagerFrontend, TouchScreen, MpdFrontend, HttpFrontend
WARNING: You are using the SDL disk writer audio driver!
Writing to file [sdlaudio.raw].
ERROR Uncaught exception
Traceback (most recent call last):
File “/usr/local/lib/python2.7/dist-packages/mopidy/commands.py”, line 276, in run
self.start_frontends(config, frontend_classes, core)
File “/usr/local/lib/python2.7/dist-packages/mopidy/commands.py”, line 374, in start_frontends
frontend_class.start(config=config, core=core)
File “/usr/lib/python2.7/dist-packages/pykka/actor.py”, line 93, in start
obj = cls(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/mopidy_touchscreen/touch_screen.py”, line 39, in init
self.screen = pygame.display.set_mode(self.screen_size)
error: Unable to open mouse
INFO Stopping Mopidy frontends
…CUT

no gui, webinterface is working

what can i do ?

thx

I do not see errors on the config. Anyway I would try this config to see what it happens as sometimes not specifying the values has made to work:

sdl_mousdrv = none
sdl_mousedev = none

To debug the problem you can also try to run a small piece of pygame code. I used the first code on this page. Comment out the lines and set your values. For example:

os.environ["SDL_FBDEV"] = "/dev/fb1"
os.environ["SDL_MOUSEDRV"] = "TSLIB"
os.environ["SDL_MOUSEDEV"] = "event0"

hi, thank you for your fast answer.

i tried this code and set my values

after installing the missing module evdev the code is running and i got a picture

the front end is still not running.

i wonder if the value event0 is somehow forgotten !?

If the other code is running probably you have a permission problem. I started the extension basing on that code so if you have it running mopidy-touchscreen should also display.

The event0 is set here.

Is mopidy running as root? Check this and edit /etc/init.d/mopidy file.

Something that I have remembered. When running as root the config that is reading mopidy can be in another dir so the changes you do on the other file are not affecting.

hi, i tried a lot of things.
i think somehow the values are still forgotten.

right now i set the values directly in the touch_screen.py
os.environ[“SDL_FBDEV”] = "/dev/fb1"
os.environ[“SDL_MOUSEDEV”] = "/dev/input/event0"
os.environ[“SDL_MOUSEDRV”] = "TSLIB"
just before pygame.init()

now i have a black screen the and the cursor is in the upper left corner. but nothing else.

mmm pimusicbox is normally running as mopidy as user. right now i had to use root as user. could there be the problem ?

i started playing music from sdcard and checked the mopidy.log i found this:

2015-07-14 08:22:02,243 - INFO 200 GET / (127.0.0.1) 24.52ms
2015-07-14 08:22:53,169 - ERROR Unhandled exception in TouchScreen (urn:uuid:929a4641-9ffe-4719-b72b-4213e515cd66):
Traceback (most recent call last):
File “/usr/lib/python2.7/dist-packages/pykka/actor.py”, line 200, in _actor_loop
response = self._handle_receive(message)
File “/usr/lib/python2.7/dist-packages/pykka/actor.py”, line 294, in _handle_receive
return callee(*message[‘args’], **message[‘kwargs’])
File “/usr/local/lib/python2.7/dist-packages/mopidy/core/listener.py”, line 33, in on_event
getattr(self, event)(**kwargs)
File “/usr/local/lib/python2.7/dist-packages/mopidy_touchscreen/touch_screen.py”, line 113, in track_playback_ended
time_position)
File “/usr/local/lib/python2.7/dist-packages/mopidy_touchscreen/screen_manager.py”, line 130, in track_playback_ended
self.screens[main_screen_index].track_playback_ended(tl_track, time_position)
File “/usr/local/lib/python2.7/dist-packages/mopidy_touchscreen/main_screen.py”, line 249, in track_playback_ended
self.dirty_area.append(pygame.Rect(self.base_size / 2,
AttributeError: MainScreen instance has no attribute 'dirty_area’
2015-07-14 08:22:53,404 - WARNING Element doesn’t implement handling of this stream. Please file a bug.
2015-07-14 08:23:07,576 - INFO New MPD connection from [127.0.0.1]:51186

Try this:

git clone https://github.com/9and3r/mopidy-touchscreen.git

Edit the touchscreen.py as you have done to be sure that the values are not lost.

cd mopidy-touchscreen
sudo python setup.py install

From the error I assume that you downloaded a version that contains errors (Probably my bad as I don’t have master in sync :disappointed_relieved:), so this way last development version will be downloaded. Anyway having the cursor is a good signal. Probably the extension is now working but because of the error nothing was displayed.

The user must be root. Musicbox uses mopidy as default but to access GPIO lines (GPIO screen) from python needs to be root.

The latest Pi Musicbox image ships with Mopidy v0.19.5. The latest version of Mopidy-Touchscreen from git is dependent on Mopidy v1.x. Using Mopidy v1.x in Musicbox v0.6 may not work very well and we don’t support it. The earlier contents of this thread (6 months ago!) are probably not the best course of action any more.

I did not notice the version incompatibility.
I will update the readme to reflect that.

But just to be clear, Musicbox will get an update soon so this is only a temporary problem (albeit a long running one).

In a future version I would very much like to avoid fiddling with the init script and requiring root privilege. Maybe we could look at bundling WiringPI’s gpio utility (or something similar) in Musicbox and have Mopidy-Touchscreen support setting up the GPIOs using that if it finds it installed?

Good to hear that musicbox will be updated soon.

To get rid of sudo in Mopidy-Touchscreen will be great as changing the script seems hackish and is where most of the people have problems.

WiringPI’s can be useful to replace RPi.GPIO but the main problem is that small screens connected to GPIO needs root to be used with pygame. I have just found this page. If it is working will be a great step to get touchscreen running without sudo.

HI,
i tried the hints.

with user mopidy i get this

2015-07-15 19:17:33,770 - ERROR Frontend (TouchScreen) initialization error: Error on display init:
Traceback (most recent call last):
File “/usr/local/lib/python2.7/dist-packages/mopidy_touchscreen/touch_screen.py”, line 78, in get_display_surface
size, pygame.FULLSCREEN)
error: Unable to open a console terminal

the info from ajclarkson doesn´t work.

daemon = root

now i have this message:
Traceback (most recent call last):
File “/usr/local/lib/python2.7/dist-packages/mopidy/commands.py”, line 276, in run
self.start_frontends(config, frontend_classes, core)
File “/usr/local/lib/python2.7/dist-packages/mopidy/commands.py”, line 374, in start_frontends
frontend_class.start(config=config, core=core)
File “/usr/local/lib/python2.7/dist-packages/pykka/actor.py”, line 93, in start
obj = cls(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/mopidy_touchscreen/touch_screen.py”, line 58, in init
self.resolution_factor)
File “/usr/local/lib/python2.7/dist-packages/mopidy_touchscreen/screen_manager.py”, line 48, in init
self.init_manager(size)
File “/usr/local/lib/python2.7/dist-packages/mopidy_touchscreen/screen_manager.py”, line 128, in init_manager
self.options_changed()
File “/usr/local/lib/python2.7/dist-packages/mopidy_touchscreen/screen_manager.py”, line 231, in options_changed
self.screens[menu_index].options_changed()
TypeError: ‘NoneType’ object has no attribute ‘getitem

The error you are getting with root is quite strange.
It seems that something went wrong initiating screens and because of that self.screens is NoneType, but this should not be happening. Check if there is any error before that one that prevents the normal creation of self.screens.