Android serial port driver (ACM) for Kivy based on usb-serial-for-android.
- In buildozer.spec add termios.so to the whitelist
- Include pyserial and android in requirements
- Add intent-filter.xml
- Add device_filter.xml to your android res/xml/ folder
- Add
<uses-feature android:name="android.hardware.usb.host" />
to your AndroidManifest.xml
# (list) python-for-android whitelist
android.p4a_whitelist = lib-dynload/termios.so
# (list) Application requirements
# comma seperated e.g. requirements = sqlite3,kivy
requirements = pyserial,android
# (str) XML file to include as an intent filters in <activity> tag
android.manifest.intent_filters = intent-filter.xml
Use like you would use serial.Serial
.
from kvserial.driver import CdcAcmSerialPort
s = CdcAcmSerialPort('/dev/ttyACM0')
s.write("Hello\n")
# etc...
A non-blocking implementation for use with twisted is included.
from kvserial.twisted import SerialPort
s = SerialPort(protocol,'/dev/ttyACM0',reactor)
# handle in protocol...