-
Notifications
You must be signed in to change notification settings - Fork 100
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
Add micropython for running python programs #471
Conversation
I just wrote a simple python program which receives a message from the #!/tmp/sd/yi-hack/bin/python3
import ffi
# Constants
O_RDWR = 0x0002
O_CREAT = 0x0200
O_NONBLOCK = 0x0004
BUF_SIZE = 512
QUEUE_NAME = "/ipc_dispatch"
# Open standard library
libc = ffi.open("libc.so.6")
# Lookup mq_open and mq_receive functions
mq_open = libc.func("p", "mq_open", "si")
mq_receive = libc.func("i", "mq_receive", "isip")
# Call mq_open on /ipc_dispatch queue
queue = mq_open(QUEUE_NAME, O_RDWR)
# Receive one message
buf = bytearray(BUF_SIZE)
mq_receive(queue, buf, BUF_SIZE, None)
print(''.join('{:02x}'.format(byte) for byte in buf)) I think this opens many new possibilities regarding plugins. Looking forward to feedback and ideas 🙂 |
I think you have forgotten a redirection in the file system.sh About micropython compilation I have a couple of question:
doesn't work for me, the path doesn't exist. Could you please check these problems? |
Hi @roleoroleo,
Do you get errors on startup?
You are right, I accidentaly installed libffi inside the dev container and didn't notice that the compiler used the host's header file. This should be fixed now 🙂
Just to be sure: Did you comment out the |
No, simply /etc/profile is not filled:
Yes, sorry.
./build-standard doesnt' exists |
Yes you are right. Seems I missed this line 😅 Fixed with 8a5ce39
It seems that the host's toolchain is picked up. I don't really know why this is happening. Did you
before running |
The latest commit 3b62f4b fixes the problem of the folder.
|
Ah no... |
…fi shared library files
c0a5902 added the missing |
Yes, it works properly. |
Hi,
this PR adds micropython to the sources, enabling the execution of python scripts on the yi camera.
After #461 is merged, a small python program could be used to receive messages (via the
ffi
module) in a loop, instead of havingipc_notify
spawn a new process for each message received.