Skip to content

EV3-G API for Button#386

Merged
dwalton76 merged 10 commits intoev3dev:developfrom
dwalton76:ev3g-api-buttons2
Oct 1, 2017
Merged

EV3-G API for Button#386
dwalton76 merged 10 commits intoev3dev:developfrom
dwalton76:ev3g-api-buttons2

Conversation

@dwalton76
Copy link
Copy Markdown
Collaborator

No description provided.

@dwalton76
Copy link
Copy Markdown
Collaborator Author

For issue #354

@dlech
Copy link
Copy Markdown
Member

dlech commented Sep 29, 2017

Might I suggest using python-evdev to simplify things a bit here?

http://python-evdev.readthedocs.io/en/latest/

@dwalton76
Copy link
Copy Markdown
Collaborator Author

That looks handy for Buttons but what about Sensors? I could just have any _wait() for a Sensor class drop into a while True loop and constantly check to see if anything changed and then someday if there is POLL support for Sensor clean it up.

@dlech
Copy link
Copy Markdown
Member

dlech commented Sep 29, 2017

For sensors, the only thing you can do for now is busy wait as you suggested.

Comment thread debian/control Outdated
Priority: optional
Standards-Version: 3.9.5
Build-Depends: python3-setuptools (>= 0.6b3), python3-all (>= 3.4), debhelper (>= 9), dh-python
Build-Depends: python3-setuptools (>= 0.6b3), python3-all (>= 3.4), debhelper (>= 9), dh-python, python-evdev
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is build deps. You don't need to add anything here.

Debian automatically figures out python package dependencies, so you don't need to add it in the binary package either.

(And this is the python2 version of the package)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverted

Comment thread ev3dev/core.py Outdated
yield f


def file_open(path):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Private?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I can undo this change, it is no longer needed.

@dwalton76
Copy link
Copy Markdown
Collaborator Author

How do I update the CI test to install python-evdev?

@dlech
Copy link
Copy Markdown
Member

dlech commented Sep 30, 2017

@dlech
Copy link
Copy Markdown
Member

dlech commented Sep 30, 2017

Or you can change sudo to true and add an install line for sudo apt-get install --yes python3-evdev

(probably needs sudo apt-get update first)

Comment thread .travis.yml Outdated
python:
- 3.4
sudo: false
sudo: true
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer not to do this... a) we already use pip for the other dependency and b) this switches the builds from container-based to full VMs which they claim are slower.

@dwalton76
Copy link
Copy Markdown
Collaborator Author

It looks like it is installing but fails to import in api_tests.py....will dig more tomorrow

@ddemidov
Copy link
Copy Markdown
Member

Sorry for being late to the train, but is there python-evdev for micropython?

@dwalton76
Copy link
Copy Markdown
Collaborator Author

I can't find where there is micropython support for python-evdev. For micropython we could always drop into a loop instead of being event driven...not great but would be a work-around.

@dlech
Copy link
Copy Markdown
Member

dlech commented Sep 30, 2017

No, micropython does not support anything that is not in the standard library and only a fraction of the standard library. We can easily implement something very similar to the parts of evdev that we need in micropython, but not in a way that is compatible with regular python (e.g. you need to use uctypes which is not api compatible with ctypes).

@dwalton76
Copy link
Copy Markdown
Collaborator Author

I need to get this in to finish the work on #388 and I think this one is in pretty good shape (no comments recently) so I am going to go ahead and merge it.

@dwalton76 dwalton76 merged commit 6315c83 into ev3dev:develop Oct 1, 2017
@dwalton76 dwalton76 deleted the ev3g-api-buttons2 branch October 2, 2017 00:56
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

Successfully merging this pull request may close these issues.

4 participants