Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hang when attempting to message a PR670 under Linux #1

Open
tomwallis opened this issue Jan 30, 2018 · 5 comments
Open

Hang when attempting to message a PR670 under Linux #1

tomwallis opened this issue Jan 30, 2018 · 5 comments

Comments

@tomwallis
Copy link

I'm running the current psychopy dev version (v 1.90.0) under Ubuntu Linux 16.04.

I'm trying to run a calibration using a PR670 spectroradiometer. Running anything in monitor center causes the app to hang (greys out; requires force quit). This also happens under the current Standalone App (v 1.85.3).

I've managed to trace the hang to line 391 of /hardware/pr.py (here). Basically, on my system, I connect to the device via serial port just fine, but the first time a message is sent (self.sendMessage) the whole thing hangs. In this case it's specifically on the "P" of "PHOTO" in "Sending command 'PHOTO' to /dev/ttyACM0". Unfortunately this hangs PyCharm's debugger, so I haven't been able to get more specific information about what's going wrong.

  • I've checked that /dev/ttyACM0 does indeed correspond to the PR670 (via /dev/serial/by-path/).
  • I haven't installed any special drivers on this system. Perhaps I'm missing a driver for the PR670, but I was unable to find a reference for one under Linux on the CD that Photo Research distribute with the device.
  • I can "initialize" the PR670 under PsychToolbox but then it times out for any further commands (suggesting it's a system problem).
  • Can anyone verify that the calls for the PR655 are the same as for the PR670? PsychoPy lumps them together in the same object class, so I assume someone tested that both work. However, PTB has separate calls for them.

Does anyone have any suggestions?

@peircej
Copy link
Member

peircej commented Jan 30, 2018

Yes, I can verify that the calls work fine for both devices (but I've never used them from ubuntu). My memory of USB devices on ubuntu was that you have this nasty business of having to arrange permissions so you can write to the device. Did you go through that?

@peircej
Copy link
Member

peircej commented Jan 30, 2018

If you are successfully detecting the device as a serial device then drivers shouldn't be necessary

@tomwallis
Copy link
Author

Ok, it looks like this was indeed a permissions problem on Ubuntu. Running the psychLinuxConfiguration file of the Psychtoolbox (which among other things, adds the user to a dialout group that allows serial port access) has fixed the problem in PsychoPy.

It may be worth checking out what Mario is doing in that script and porting something similar to PsychoPy, or at least probing if the user has sufficient permissions.

If I were to look into porting this over:

  1. How does that work with licensing (if I'm basically copying Mario's code)?
  2. Where should such a routine be put within PsychoPy? Ideally it would run when PsychoPy standalone opens the first time, to check that the user has sufficient permissions.

@tomwallis
Copy link
Author

A simple, hacky solution would be to make people set up their hardware with PTB under Octave first. Then we completely rely on Mario, and also get changes he adopts. I'm not sure if that's super cheeky, though.

e.g. after installing psychopy on linux, a message says:

Please install ptb3-octave from the neurodebian distro, then

octave --no-gui
psychLinuxConfiguration

@peircej
Copy link
Member

peircej commented Feb 2, 2018

  1. copying the code is no problem - we just have to keep the license for the code clearly pasted.
  2. I'm sure the actual script functions aren't hard to port over. The issue here is that the user probably needs to run the config script as sudo. We don't usually ask users to run the app as sudo. We could certainly have our own config script and tell people to run that with sudo as needed. I imagine the apt-get install procedure could run the script too (assuming people used apt-get instead of pip install) and that would be the cleanest solution. But maybe both.

I'm not a fan of requiring users to install octave and PTB just for the sake of setting up USB permissions.

@TEParsons TEParsons transferred this issue from psychopy/psychopy Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants