|
Edited by wwwlu at 2017-2-24 17:51
I can't read the serial port of my OPI pc plus with Armbian
My python script (which works fine on lubuntu)
- #!/usr/bin/env python
- # -*- coding: latin-1 -*-
- import serial
- import os
- ser = serial.Serial('/dev/ttyS0', 9600)
- while True :
- data = ser.readline()
- print (data)
- if "stop" in data:
- os.system('sudo shutdown -h now')
Copy code returns :
- Traceback (most recent call last):
- File "off.py", line 10, in <module>
- data = ser.readline()
- File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 453, in read
- buf = os.read(self.fd, size-len(read))
- OSError: [Errno 11] Resource temporarily unavailable
Copy code
I tried :
- sudo minicom -D /dev/ttyS0
Copy code result:
- Device /dev/ttyS0 is locked.
Copy code
and with:
i get :
- [ 0.000000] Kernel command line: console=tty1 root=/dev/mmcblk0p1 rootwait rootfstype=ext4 cgroup_enable=memory swapaccount=1 panic=10 consoleblank=0 enforcing=0 loglevel=7
- [ 0.000000] console [tty1] enabled
- [ 0.460131] uart0: ttyS0 at MMIO 0x1c28000 (irq = 32) is a SUNXI
- [ 6.252629] systemd[1]: Expecting device dev-ttyS0.device...
- [ 6.488254] systemd[1]: Starting system-getty.slice.
- [ 6.497739] systemd[1]: Created slice system-getty.slice.
- [ 6.502287] systemd[1]: Starting system-serial\x2dgetty.slice.
- [ 6.511686] systemd[1]: Created slice system-serial\x2dgetty.slice.
Copy code
What can I do ?
Thanks!
|
|