oscpy
oscpy copied to clipboard
Using tag from a displax screen make listener thread crash
Describe the bug When using a DISPLAX tag supporting TUIO on a DISPLAX screen, oscpy TUIO listener crash:
❯ oscli dump -P 3333
Exception in thread Thread-1:
Traceback (most recent call last):
File "/home/tito/.pyenv/versions/3.9.9/lib/python3.9/threading.py", line 973, in _bootstrap_inner
self.run()
File "/home/tito/.pyenv/versions/3.9.9/lib/python3.9/threading.py", line 910, in run
self._target(*self._args, **self._kwargs)
File "/home/tito/code/oman/.venv/lib/python3.9/site-packages/oscpy/server.py", line 338, in _run_listener
self._listen()
File "/home/tito/code/oman/.venv/lib/python3.9/site-packages/oscpy/server.py", line 386, in _listen
for address, tags, values, offset in read_packet(
File "/home/tito/code/oman/.venv/lib/python3.9/site-packages/oscpy/parser.py", line 416, in read_packet
timetag, messages = read_bundle(
File "/home/tito/code/oman/.venv/lib/python3.9/site-packages/oscpy/parser.py", line 390, in read_bundle
address, tags, values, off = read_message(
File "/home/tito/code/oman/.venv/lib/python3.9/site-packages/oscpy/parser.py", line 309, in read_message
value, off = parse(
File "/home/tito/code/oman/.venv/lib/python3.9/site-packages/oscpy/parser.py", line 202, in parse
raise ValueError(
ValueError: no known parser for type hint: 116, value: b'#bundle\x00\x00\x00\x01\x86\xa5l+D\x00\x00\x008/tuio2/frm\x00\x00,itis\x00\x00\x00\x00\x08\xdf\xc2d\x01\xf1`\xd6\x04\x18\x92 \x08\x12*Ultra 023009000107\x00\x00\x00\x00\x00\x10/tuio2/alv\x00\x00,\x00\x00\x00'
To Reproduce Code example showing the issue:
import socket
message = b'#bundle\x00\x00\x00\x01\x86\xa5l+D\x00\x00\x008/tuio2/frm\x00\x00,itis\x00\x00\x00\x00\x08\xdf\xc2d\x01\xf1`\xd6\x04\x18\x92 \x08\x12*Ultra 023009000107\x00\x00\x00\x00\x00\x10/tuio2/alv\x00\x00,\x00\x00\x00'
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.sendto(message, ("127.0.0.1", 3333))
Expected behavior I should not expect crashing. Maybe due to type or bundle issue, will search.
Logs/output If applicable, add screenshots to help explain your problem.
Platform (please complete the following information):
- OS: Windows 10, Arch linux.
- Python 3.9 + 3.11
- oscpy 0.6.0
So actually, this is part of TUIO 2.0 Specifications, which are not supported by oscpy: https://www.tuio.org/?tuio20
Parameter description | Short message format | Custom message code | OSC data type | value range |
---|---|---|---|---|
Session ID | s_id | S | 32bit integer | uint32 0 ... 4.294.967.295 |
Component ID | c_id | I | 32bit integer | uint32 0 ... 4.294.967.295 |
Type/User ID | tu_id | T | 32bit integer | uint16 0 ... 65535 (x2) |
Frame ID | f_id | F | 32bit integer | uint32 0 ... 4.294.967.295 |
Frame Time | time | t | 64bit OSC time tag | sec/nsec |
Point Coordinate | x_pos, y_pos, z_pos | x y z | 32bit float | 0.0f ... 1.0f |
Angle | angle | a | 32bit float | 0.0f ... 2Pi |
Pressure/Hover | press | p | 32bit float | -1.0f ...1.0f |
Motion Velocity | x_vel, y_vel, z_vel | X Y Z | 32bit float | -n ... n |
Acceleration | m_acc | m | 32bit float | -n ... n |
Rotation Velocity | r_vel | A | 32bit float | -n ... n |
Rotation Accel | r_acc | r | 32bit float | -n ... n |
Width | width | w | 32bit float | 0.0f ... 1.0f |
Height | height | h | 32bit float | 0.0f ... 1.0f |
Depth | depth | d | 32bit float | 0.0f ... 1.0f |
Area/Volume | area/vol | f/v | 32bit float | 0.0f ... 1.0f |
Link ID | l_id | L | 32bit integer | uint16 0 ... 65535 (x2) |
Source Name | source | N | OSC String | nx4 bytes |
Symbol Data | data | D | OSC String/Blob | nx4 bytes |
Data MIME Type | mime | M | OSC String | nx4 bytes |
Symbol Group | group | G | OSC String | nx4 bytes |
Node Jump | node | n | 32bit integer | uint32 0 ... 4.294.967.295 |
Custom Parameter | int, float, string ... | P | any OSC type |
https://github.com/kivy/oscpy/compare/master...tito:oscpy:displax-tag
Nice, feel free to do a PR for it, it was indeed in the TODO i never got back to.