Open mariolicona opened 9 years ago
@mariolicona Make sure
/dev/ttyUSB0
port, you have to use /dev/ttyUSB2
insteadscreen /dev/ttyUSB2 115200
, or python tools/gsmterm.py -b 115200 /dev/ttyUSB2
), you should see messages like ^BOOT, ^RSSI, ^CSNR etc.@Andati good tip for processing all older messages from the period the python daemon was not running, but it can't resolve the issue that mariolicona describes.
I'm also having this issue.
If I use Port = '/dev/ttyUSB0'
I can read my number (using the own_number_demo.py
example) and send messages (using the modem.sendSms()
function).
However, I cannot seem to be able to access /dev/ttyUSB2
so therefor I cannot receive messages.
dev/ttyUSB2
with the command chmod 777 /dev/ttyUSB2
PORT = '/dev/ttyUSB2'
when i'm not calling sudo
I get the following error:
-> % python own_number_demo.py
Initializing modem...
INFO: Connecting to modem on port /dev/ttyUSB2 at 115200bps
Traceback (most recent call last):
File "/home/eric/.local/lib/python3.6/site-packages/serial/serialposix.py", line 265, in open
self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
OSError: [Errno 16] Device or resource busy: '/dev/ttyUSB2'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "own_number_demo.py", line 38, in
- if I run the demos and call `sudo` I get this error
-> % sudo python own_number_demo.py
Initializing modem...
INFO: Connecting to modem on port /dev/ttyUSB2 at 115200bps
DEBUG: write: ATZ
Traceback (most recent call last):
File "own_number_demo.py", line 38, in
Any advice would be appreciated @babca.
After some digging i think this might be a lower level problem and have posted a question on [superuser stackExchange](https://superuser.com/questions/1412935/linux-cu-command-returns-line-in-use)
Please use a maintained fork: https://github.com/babca/python-gsmmodem faucamp's repo is abandoned.
Have you tried to use '/dev/ttyUSB1' port as well?
The device can be occupied by a another program or another instance of gsmmodem which is still running. Check running processes.
I was never forced to use chmod
on /dev/ttyUSBx, defaults should be fine.
Hi @babca, thanks a lot for your reply. I am now using the maintained fork, and i just solved this issue.
I did try using /dev/ttyUSB1
that also did not work
I solved the use by running sudo lsof | grep tty
from there i saw there was a process running on /dev/ttyUSB2
once i killed that process sudo kill <PID>
I was able to run the examples using PORT = '/dev/ttyUSB2'
and now it is functioning as expected.
The first time i didn't run lsof
as the super user so i didn't see all the processes running.
If you think it would be helpful I'll happily transfer this information to your fork.
I couldn't remember the last time I saw this error. Now I remember, it was a process which occupied the port, as well. The same reason.
I created a simple FAQ section in https://github.com/babca/python-gsmmodem/blob/master/README.rst. Feel free to improve it 👍
Looks great, thanks for maintaining this project and documenting. I'm working on using this package in combination with Django to so i can upload messages to a cloud server, which are then sent to a local computer (in Lesotho) and then sent to local customers phones. The same also will work in reverse (messages from phones -> to local computer -> to cloud server). I'll try to document the process and once it's ready I'll share the project with you in case your interested.
Thanks again!
On Mon, Mar 11, 2019 at 6:22 PM babca notifications@github.com wrote:
I couldn't remember when I saw this error last time. Now I remember, it was a process which occupied the port, as well. The same reason.
I created a simple FAQ section in https://github.com/babca/python-gsmmodem/blob/master/README.rst. Feel free to improve it 👍
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/faucamp/python-gsmmodem/issues/41#issuecomment-471637520, or mute the thread https://github.com/notifications/unsubscribe-auth/Ahs2RjebFD49sTnCwruXuDuP1B39hzGHks5vVpDCgaJpZM4CmZRt .
Great news Eric. Share it for everyone! :-)
Add the following code after line 34 of sms_handler_demo.py:
So that the code reads: