Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[solved] Parallel port trigger stopping

edited April 2016 in OpenSesame

Hi!

I'm trying to use OpenSesame with parallel_port_trigger plug-in to trigger events in an EEG-recording software (EMOTIV's TestBench), both run on the same machine under ubuntu.

I followed the instructions (from http://osdoc.cogsci.nl/3.0/devices/triggers/) but however my experiment is stopping right after the start with following text:

text begin =====================================

Stopped

The experiment did not finish normally for the following reason:

  • Could not access the Parallel Port

Details

  • item-stack: experiment[prepare].new_parallel_port_trigger[prepare]
  • exception message: [Errno 2] No such file or directory: '/dev/parport0'
  • time: Wed Mar 30 17:16:33 2016
  • exception type: OSError

Traceback (also in debug window)


File "/home/nkobelev/pythonTest/OpenSesame-release-3.0.7/plugins/parallel_port_trigger/parallel_port_trigger.py", line 103, in prepare self.experiment.pptrigger = parallel.Parallel() File "/home/nkobelev/pythonTest/OpenSesame-release-3.0.7/plugins/parallel_port_trigger/parallelppdev.py", line 187, in __init__ self._fd = os.open(self.device, os.O_RDWR) OSError: [Errno 2] No such file or directory: '/dev/parport0'

Any ideas what am I doing wrong?

Comments

  • edited March 2016

    HI Kobi,

    You need to specify the device that corresponds to the parallel port. You have specified /dev/parport0 (the default on non-Windows systems), but this device apparently doesn't exist on your system. So you will need to find out what the parallel port is called. What operating system are you using?

    Cheers,
    Sebastiaan

  • edited March 2016

    Hi Sebastiaan,

    thanks for Your fast response!

    My operating system is Ubuntu 12.04 . I didn't specify the port as it was said in the instructions that the value for port in the parallel_port_trigger is ignored under Linux. If I do specify the port the error-text remains the same.

    UPDATE: TestBench (my EEG scanning software) listens to serial port triggers not parallel port if I understand it correctly (I can choose only from ttyS0 - ttyS31).
    Is there another way to produce serial port triggers in OpenSesame?

    UPDATE2:
    I tried to execute an inline_script item with following code:

    import serial
    exp.serial_port = serial.Serial('/dev/ttyS1',baudrate=19200, bytesize=serial.EIGHTBITS,stopbits=1)
    print(exp.serial_port.name)
    exp.serial_port.write(chr(1))
    exp.serial_port.close
    

    I can see /dev/ttyS0 in debug output window,
    but I can't see any trigger events in the EEG-software.

    any other ttySX return following error-text:

    Stopped
    
    The experiment did not finish normally for the following reason:
    
    Error while executing inline script
    
    Details
    
    - item-stack: `experiment[run].new_inline_script[run]`
    - exception type: `SerialException`
    - exception message: `Could not configure port: (5, 'Input/output error')`
    - item: `new_inline_script`
    - time: `Thu Mar 31 15:10:34 2016`
    - phase: `run`
    
    Traceback (also in debug window)
    
    .traceback
      File "/home/nkobelev/pythonTest/OpenSesame-release-3.0.7/libopensesame/inline_script.py", line 102, in run
        self.experiment.python_workspace._exec(self.crun)
      File "/home/nkobelev/pythonTest/OpenSesame-release-3.0.7/libopensesame/python_workspace.py", line 159, in _exec
        exec(bytecode, self._globals)
      File "", line 5, in 
      File "/usr/local/lib/python2.7/site-packages/serial/serialutil.py", line 177, in __init__
        self.open()
      File "/usr/local/lib/python2.7/site-packages/serial/serialposix.py", line 300, in open
        self._reconfigure_port(force_update=True)
      File "/usr/local/lib/python2.7/site-packages/serial/serialposix.py", line 332, in _reconfigure_port
        raise SerialException("Could not configure port: {}".format(msg))
    SerialException: Could not configure port: (5, 'Input/output error')
    
    
    

    Cheers,
    Niklas

  • edited April 2016

    I think I've found a solution. Now I can send trigger events to serial port from OpenSesame and see them in TestBench. For the case someone else has same difficulties with TestBench and OpenSesame on Ubuntu:

    Step1: open terminal and create a pair of virtual ports with socat

    sudo socat PTY,link=/dev/ttyS10,b19200 PTY,link=/dev/ttyS11,b19200
    

    Step2: open another terminal and grant a read/write permissions for the new ports:

    sudo chmod o+rw /dev/ttyS10
    sudo chmod o+rw /dev/ttyS11
    

    Step3: open OpenSesame and create an inline_script item.
    in that item write:

    import serial
    s = serial.Serial('/dev/ttyS10',baudrate=19200,
          bytesize=serial.EIGHTBITS,stopbits=1)
    s.write(chr(1))
    s.close()
    

    Step4: open TestBench, go to marker->configure serial port and select the same port as You created with socat (ttyS11 in my case) and set bit per seconds to the same rate as you specified in socat (19200 in my case).

    That's It! Now as You execute the inline_script in OpenSesame You should see an event with a value=1 in TestBench.

    I hope it works for You too!

    Cheers,
    Niklas

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games