You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We don't have a way to do that but from looking at the EV3-G block it doesn't either? It sounds useful though (and we have it for TouchSensor), we can add it.
robot@evb[bin]# ./buttons.py
Traceback (most recent call last):
File "./buttons.py", line 19, in <module>
btn = Button()
File "/usr/local/lib/python3.5/dist-packages/python_ev3dev-0.8.0.post69-py3.5.egg/ev3dev/core.py", line 3178, in __init__
FileNotFoundError: [Errno 2] No such file or directory: '/dev/input/by-path/platform-gpio_keys-event'
robot@evb[bin]#
Am running this on my EVB:
robot@evb[ev3dev-lang-python]# ev3dev-sysinfo
Image file: ev3dev-stretch-bone-generic-2017-09-01
Kernel version: 4.9.41-ev3dev-1.4.0-bb.org
/usr/bin/ev3dev-sysinfo: line 68: warning: command substitution: ignored null byte in input
Board: TI AM335x BeagleBone Black
Revision: 000c
Brickman: 0.10.0
ev3devKit: 0.5.2
robot@evb[ev3dev-lang-python]#
Will the kernel set select.POLLPRI when /dev/input/by-path/platform-evb-buttons-event is modified? It doesn't seem to be...the _wait() that I wrote is almost identical to the one used by TouchSensor but I never get an event that the file changed.
POLLIN works for me, so I can't really help much unless you have some code to reproduce the problem. I suspect that there is a problem with your code rather than a problem with ev3dev.
After a bit more research, it seems that poll with sysfs only support POLLPRI, so what you observed with the motor state sysfs attribute is the expected behavior.
Another thing is that if you have never read a file, poll won't block. So you have to read at least once before calling poll if you want to see it block.
Activity
dwalton76 commentedon Sep 23, 2017
What we have right now for
class Buttoninev3dev/ev3.pylooks pretty good to me. Is there anything to be done for this one?PS
How does one use the on_left(), etc methods?
dwalton76 commentedon Sep 26, 2017
@WasabiFan @dlech can you spot anything that we are missing to be EV3-G 1:1? If not lets close this one.
dlech commentedon Sep 26, 2017
How do you wait for a button to be pressed/released/bumped?
dwalton76 commentedon Sep 26, 2017
We don't have a way to do that but from looking at the EV3-G block it doesn't either? It sounds useful though (and we have it for TouchSensor), we can add it.
dlech commentedon Sep 26, 2017
And what about bumped?
dwalton76 commentedon Sep 26, 2017
I'll add pressed, released and bumped
dlech commentedon Sep 26, 2017
Here is a more fleshed out view of the EV3-G buttons blocks:
dwalton76 commentedon Sep 27, 2017
@dlech for EVB what should its _buttons be now? This is what we have for EV3
EVB barfs on
Am running this on my EVB:
dwalton76 commentedon Sep 27, 2017
you know what, I probably need to update my EVB, ignore this for a bit
dwalton76 commentedon Sep 27, 2017
nope same issue
dlech commentedon Sep 27, 2017
Looks like
/dev/input/by-path/platform-evb-buttons-eventwill work.dwalton76 commentedon Sep 28, 2017
Will the kernel set
select.POLLPRIwhen/dev/input/by-path/platform-evb-buttons-eventis modified? It doesn't seem to be...the_wait()that I wrote is almost identical to the one used by TouchSensor but I never get an event that the file changed.dlech commentedon Sep 28, 2017
Try
select.POLLIN. It is rare to use POLLPRI.dwalton76 commentedon Sep 28, 2017
ok it turns out polling for TouchSensor isn't working, I just thought it was because POLLIN never blocks. What I am seeing...
Motor wait()
TouchSensor _wait()
buttons _wait()
dlech commentedon Sep 28, 2017
Which kernel version? POLLIN is working for me on
4.9.49-ev3dev-1.5.1-ev3on motors and buttons (haven't tried sensors).dlech commentedon Sep 28, 2017
Actually, I take that back about buttons. I'm just reading directly on a background thread without polling.
readblocks until there is data available.dwalton76 commentedon Sep 28, 2017
dwalton76 commentedon Sep 29, 2017
@dlech want me to file an issue for POLLIN support on motors, sensors and buttons files? Either that or POLLPRI for all three.
dlech commentedon Sep 29, 2017
POLLIN works for me, so I can't really help much unless you have some code to reproduce the problem. I suspect that there is a problem with your code rather than a problem with ev3dev.
dwalton76 commentedon Sep 29, 2017
I haven't used poll much, I just followed what was done for motors. Here is what I did for TouchSensor:
https://github.com/rhempel/ev3dev-lang-python/blob/develop/ev3dev/core.py#L2275-L2285
and here is the motors equivalent
https://github.com/rhempel/ev3dev-lang-python/blob/develop/ev3dev/core.py#L920-L940
dlech commentedon Sep 29, 2017
I don't see that notification for sensors was ever implemented, so I don't expect that to work.
ev3dev/ev3dev#498
dlech commentedon Oct 2, 2017
After a bit more research, it seems that poll with sysfs only support POLLPRI, so what you observed with the motor state sysfs attribute is the expected behavior.
dlech commentedon Oct 2, 2017
Another thing is that if you have never read a file, poll won't block. So you have to read at least once before calling poll if you want to see it block.
dwalton76 commentedon Oct 3, 2017
Ack will fix that for motors, that is the only place we are using POLLPRI