cedrus-opensource / xid_device_library

Library for interacting with XID devices
http://www.cedrus.com
BSD 3-Clause "New" or "Revised" License
4 stars 1 forks source link

Samples codes not working #2

Open sainathmurali opened 3 months ago

sainathmurali commented 3 months ago

The sample codes related to pyxid2 (eg., XIDDeviceScanner, DetectXIDDevices,...) are not working as the functions inside pyxid2 changed. Please upload the updated sample codes.

ematsakCedrus commented 3 months ago

Could you be more specific? I just downloaded pyxid2 via pip and ran the event_markers.py sample with a StimTracker 2 Quad without issue.

Can you show us the error? Which sample are you using? Which Cedrus device? What platform? How did you obtain pyxid2?

Any additional details would help.

sainathmurali commented 3 months ago

Sorry! I should've been more specific about the device. The stim tracker code example from eventmarkers.py is working fine for me. I'm trying to use the below chunk of code in the readme page of this repository for Riponda response pad in windows. Some of the functions in this code doesn't exist in the pyxid2 library.

import time
import pyxid2

scanner = pyxid2.XIDDeviceScanner.GetDeviceScanner()

print "Detecting XID devices..."
scanner.DetectXIDDevices()

devCount = scanner.DeviceCount()
if (devCount == 0):
    print "No devices found."
    quit()

devCon = scanner.DeviceConnectionAtIndex(0)
print devCon.GetCombinedInfo()

devCon.ClearResponseQueue()
devCon.ClearResponsesFromBuffer()

print "Press a button!"
while (devCon.HasQueuedResponses() == False):
    devCon.PollForResponse()

response = devCon.GetNextResponse()
print "---Fetched Response---"
print '%-20s%-20s' % ("port: ", response.port)
print '%-20s%-20s' % ("key: ", response.key)
print '%-20s%-20s' % ("wasPressed: ", response.wasPressed)
print '%-20s%-20s' % ("reactionTime: ", response.reactionTime)
ematsakCedrus commented 3 months ago

Oh. Thank you for pointing this out! We'll fix this shortly, and for now you can use code in the "sample" folder.

sainathmurali commented 2 months ago

Thank you.

ematsakCedrus commented 2 months ago

I just realized that there is further confusion here. The pyxid2 in this repo is a very outdated and defunct version made with c++ bindings. The actual up to date repo for pyxid2 that you would get from pip is here: https://github.com/cedrus-opensource/pyxid/

Sorry for the confusion! I'll remove the pyxid2 folder and mentions of it from this repo and the readme.