kawasaki / pyscrlink

Scratch-link for Linux written in python
BSD 3-Clause "New" or "Revised" License
120 stars 24 forks source link

BUG Method always returns None and awaits a miracle? ;) #33

Open XeNONE1100 opened 1 year ago

XeNONE1100 commented 1 year ago

Hi,

Just heaving trying to have some fun with an ev3 and I realized that something is never gonna happen until it's changed...

https://github.com/kawasaki/pyscrlink/blob/751190935a457d7a6a207abb71542188cb76361f/pyscrlink/scratch_link.py#L70

I cannot connect to EV3 as jsonres is always None due to handle_request always returning None.

https://github.com/kawasaki/pyscrlink/blob/751190935a457d7a6a207abb71542188cb76361f/pyscrlink/scratch_link.py#L80

Log: 2023-01-20 11:04:04,499 start recv_request 2023-01-20 11:04:04,499 request: {"jsonrpc":"2.0","method":"discover","params":{"majorDeviceClass":8,"minorDeviceClass":1},"id":0} 2023-01-20 11:04:04,499 default handle_request: discover, {'majorDeviceClass': 8, 'minorDeviceClass': 1} 2023-01-20 11:04:04,499 Failure in session for web socket path: /scratch/bt

What should jsonres contain? Thank you!

kawasaki commented 1 year ago

Hi @XeNONE1100

Unfortunately, pyscrlink dropped EV3 support in last July. EV3 uses legacy bluetooth protocol. pyscrlink had used the library pybluez to support the legacy bluetooth sprotocol, but it got unstable. To support EV3 again, I would like to find out other good library to replace pybluez (python-sdbus-bluez looks good, so far). It will take more time to decide good library and re-implement EV3 support.

asaldele1 commented 5 months ago

This pybluez fork works fine with EV3: https://github.com/AcrossTheCloud/pybluez

SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats fixed in original pybluez repo.

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 4: invalid start byte fixed in this fork.

asaldele1 commented 5 months ago

For now i have created fork that does installs everything for ev3 automatically. It uses dependency link, so you can't use pip install with this repo. To use EV3:

git clone https://github.com/asaldele1/pyscrlink.git
cd pyscrlink
python3 setup.py install --user