oozie / pyhumod Goto Github PK
View Code? Open in Web Editor NEWUsing Huawei Modems in Python
License: Other
Using Huawei Modems in Python
License: Other
I installed pyHuMod-0.03 on python 2.6 and ran following commands
>>> import humod
>>> m=humod.Modem()
>>> m.show_model()
It prints out.. '^RSSI:12'
>>> m.sms_list()
results in an output like this...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "humod/at_commands.py", line 160, in sms_list
messages_data = message_lister.set('"%s"' % message_type)
File "humod/at_commands.py", line 64, in set
self.prefixed)
File "humod/humodem.py", line 158, in send_at
return self.return_data(cmd)
File "humod/humodem.py", line 181, in return_data
errors.check_for_errors(input_line)
File "humod/errors.py", line 35, in check_for_errors
raise AtCommandError, input_line
humod.errors.AtCommandError: ERROR
Original issue reported on code.google.com by keheliya.gallaba
on 16 Oct 2010 at 4:37
What steps will reproduce the problem?
1. Connecting an E1550 Huawei modem
2. Trying to see the version/send messages/read messages
3.
What is the expected output? What do you see instead?
I can't see any action, it sort of freezes.
What version of the product are you using? On what operating system?
I'm using the latest version on Ubuntu 11.04
Please provide any additional information below.
I've used pyhumod with my E220 modem and it allways worked perfectly, but
recently i've bought a new modem, a Huawei E1550 and the program i've been
using with the E220, simply just won't work. Does any one knows why?
Original issue reported on code.google.com by [email protected]
on 12 May 2011 at 10:16
When I send a message with special characters to my modem (Model E226) I cannot read the message. For example, if I send an SMS with the word Produção, when trying to read the message 00500072006F0064007500E700E3006F appears
Discovered this silly bug while troubleshooting the other issue.
In [6]: m.sms_list()
Out[6]:
[['0', 'REC READ', 999222, '', '12/05/10,10:05:41+08'], <-- '0' string
[1, 'REC READ', 9996248, '', '12/05/10,09:50:51+08'],
[2, 'REC READ', 9996248, '', '12/05/10,10:18:44+08'],
[3, 'REC READ', 9996248, '', '12/05/10,10:24:53+08'],
[4, 'REC READ', 9996248, '', '12/05/19,12:38:57+08'],
[5, 'REC READ', 999222, '', '12/05/19,15:05:25+08'],
[6, 'REC READ', 9996248, '', '12/05/20,12:51:05+08'],
[7, 'REC READ', 999222, '', '12/05/20,14:15:10+08'],
[8, 'REC READ', 9996248, '', '12/05/20,17:55:00+08'],
[9, 'REC READ', 9996248, '', '12/05/21,01:54:36+08']]
In [7]:
if I read the sms with (Huawei E270) i only the the pasts of the message that are not a umlaut.
message saved in Sim card (made sure with a mobile)
"Klopuzofäblöda"
if I run: modem.sms_read(0) i'll get:
"Klolpuzofblda"
without any error or any infomation, that the encoding removed parts.
if I look at the information, that is sent over the tty also the umlauts are missing. Do I need to set the encoding somewhere for the E270?
Hey everyone,
So finally got that dongle in the mail and delivered.
However whenever I try to print the model it just hangs, for ever untill I ctrl-z / keyboard interrupt.
However, I was toying with pyserial after, and I did something to trigger a change in the path of the dongle. /dev/ttyUSB0 - 3 now became /dev/ttyUSB1 - 4 .
With this weird change in mind, I went back to try humod, this time it gave me an error and told me it couldn't find /dev/ttyUSB0 . (not strange since the paths scooped up a position)
So I ran the same script, only this time with: m = humod.Modem('/dev/ttyUSB1') and strangely enough the script printed the model number instantly.
However, after rebooting my pi, all paths are back to normal, and the issue is back.
Can someone shine some light on this?
Thanks!
Happens if self.readline()
returns byte data in humodem.py, line 172.
input_line = self.readline().decode().rstrip()
Maybe we should catch the exception like so.
while 1:
# Read in one line of input.
coded_input_line = self.readline()
try:
# input_line = self.readline().decode().rstrip()
input_line = coded_input_line.decode().rstrip()
except serial.serialutil.SerialException:
time.sleep(.2)
continue
except UnicodeDecodeError:
""" b'\x00\x06&application/vnd.wap.mms-message
\x00\xaf\x84\x8d\xff\xb4\x81\x8c\x82\x98nw\x00\x8d\x90\x89\x19\x80
+447736000000/TYPE=PLMN
\x00\x8a\x80\x8e\x03\x08\xb5/\x88\x05\x81\x03\t:\x80\x83
http://mmsc-ac1.mms.o\r\n'
"""
print(coded_input_line)
continue
What steps will reproduce the problem?
1. Send an SMS to the E220 that contains international characters (å,ä,ö)
2. Reading the SMS from the device using sms_read() returns the SMS
without the international characters.
3.
What is the expected output? What do you see instead?
I send:
Testar att skicka ett sms med övriga tecken som inte används i
engelskspråkiga länder.
sms_read() returns:
Testar att skicka ett sms med vriga tecken som inte anvnds i
engelsksprkiga lnder.
What version of the product are you using? On what operating system?
pyhumod 0.03 on Slackware 13.0 with Linux 2.6.33.1
Please provide any additional information below.
Sending SMS with international characters:
>>> m.sms_send('+46xxxxxxxxx', 'Testar att skicka med å och ä och ö.')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python2.6/site-packages/humod/at_commands.py", line
136, in sms_send
result = self.ctrl_port.return_data()
File "/usr/lib64/python2.6/site-packages/humod/humodem.py", line 179, in
return_data
input_line = self.readline().rstrip()
File "/usr/lib64/python2.6/site-packages/serial/serialutil.py", line 62,
in readline
c = self.read(1)
File "/usr/lib64/python2.6/site-packages/serial/serialposix.py", line
353, in read buf = os.read(self.fd, size-len(read))
OSError: [Errno 11] Resource temporarily unavailable
Original issue reported on code.google.com by [email protected]
on 21 May 2010 at 11:20
How to run sim tool kit, and go through the menus
This is probably as a result of these lines in humodem.py
179 if input_line == 'OK':
180 return data
I haven't figured out a workable fix yet. I'm also not very sure what I'd be at risk of breaking.
Hello there,
Is it possible to Instantiating a Modem in Windows? only Linux and Mac are listed.
If so, please let me know.
Thanks!
Please help me, when i use the CoolApps.rst example i get that error:
AttributeError: 'Modem' object has no attribute 'read_message'
It seem that when the modem receive an sms it can not read it because off this error.
Hey all!
I'm working on a project where I'd like to use a GSM modem / dongle to act as a proxy server through python.
At my current provider, whenever I disconnect and reconnect to the mobile network, my IP changes.
My goal is to replicate that in python, connecting to the dongle whenever a proxy is needed and disconnecting + reconnecting whenever I need it changed.
If anyone could let me know, that would be great.
Huawei dongles are pretty expensive and hard to come by around here so I'd like to be sure before purchasing one!
Thanks!
Hi,
I connected a E180 to an RPI, and trying to get the model using the basic example shown in the documentation. I have a virtualenv with the latest version of serial and python 2.7.
Unfortunately, the method show_model hangs (as described in another issue with a E1750).
It seems that the select.select statement in serialposix.py doesn't can't read from the file.
However, I have no issue at all when using the miniterm.py shipped with the serial library.
Any clue?
Thanks.
May I ask to retire Google Code project and add a link there to point users to Github.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.