Hello,
I am trying to connect my Nokia 6610 using usb cable,
I have installed usb-serial driver of it.
I hv tested it with Hyperterminal and it works fine.
but when I wrote a python script I am not able to receive the responce
from the device.
import os
import re
import time
import sys
from threading import Thread
import serial
class connect_serial( Thread):
def __init__(self,s ocks):
Thread.__init__ (self)
self.sock = socks
self.count = 0
def run(self):
self.count = 0
try:
while 1:
self.count +=1
if (self.count>=5) :
break
lines = self.sock.read( 100)
if lines:
print lines
print 'read
success-----------------------------------------------'
else:
print 'nothing to read',str(self. getName())
except Exception,e:
print self.getName()
print time.ctime()
print
try:
conn1 = serial.Serial(4 )
conn1.baudrate = '9600'
conn1.parity = serial.PARITY_E VEN
conn1.timeout=1
except Exception,e:
print 'port is Buzy'
sys.exit(-1)
print '------------------------------'
print 'getSupportedBa udrates',conn1. getSupportedBau drates()
print 'getSupportedBy teSizes',conn1. getSupportedByt eSizes()
print 'getSupportedPa rities',conn1.g etSupportedPari ties()
print 'getSupportedSt opbits',conn1.g etSupportedStop bits()
print '------------------------------'
print 'getBaudrates', conn1.getBaudra te()
print 'getByteSizes', conn1.getByteSi ze()
print 'getParities',c onn1.getParity( )
print 'getStopbits',c onn1.getStopbit s()
print '------------------------------'
print 'port is in use',conn1.port str
list1 = []
command = ['AT','ATI','ATl 1','AT+GMMM']
for cmd in command:
conn1.write(str (cmd))
th = connect_serial( conn1)
list1.append(th )
th.start()
for th1 in list1:
print 'started joining',th1.ge tName(), 'counter :',th1.count
th1.join()
print time.ctime() 2 2427
En Tue, 03 Jul 2007 10:01:51 -0300, Japan Shah <sh*******@gmai l.com>
escribió:
I am trying to connect my Nokia 6610 using usb cable,
I have installed usb-serial driver of it.
I hv tested it with Hyperterminal and it works fine.
but when I wrote a python script I am not able to receive the responce
from the device.
lines = self.sock.read( 100)
If the response contains less than 100 bytes, the above line will block.
command = ['AT','ATI','ATl 1','AT+GMMM']
for cmd in command:
conn1.write(str (cmd))
Don't you have to send <ENTERafter each command? "\n"
th = connect_serial( conn1)
list1.append(th )
th.start()
You can't have four threads all reading the same serial port. The device
sends its responses sequentially anyway.
--
Gabriel Genellina
In article <11************ **********@m37g 2000prh.googleg roups.com>,
Japan Shah <sh*******@gmai l.comwrote:
>Hello,
I am trying to connect my Nokia 6610 using usb cable, I have installed usb-serial driver of it.
I hv tested it with Hyperterminal and it works fine.
but when I wrote a python script I am not able to receive the responce from the device.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: willie |
last post by:
Hi,
I'm writing a program which requires the use of three serial ports and
one parallel port. My application has a scanning devices on each port,
which I can access fine with pyserial. However, I'm unsure of how
exactly I should be designing the program, I thought I could use
threading to start class:
class scanner(Thread):
def __init__(self,port):
|
by: McBooCzech |
last post by:
Hi
I am just trying to analyze (parse) data from the serial port (I have
connected GPS receiver to the ttyS0, so I can read ASCII characters in
the CSV form on the serial port 1).
I am doing this just to understand how Python works (yes, you can call
me Python/Linux newbie :)
My environment is Fedora Core 4, Python 2.4.1
CSV alone (to read CSV data from the file) and py-serial alone (to
read data from the serial port) are working...
|
by: Casey Bralla |
last post by:
I'd like to read ASCII data from a serial port, but (once again) I'm having
trouble getting started. (Can't seem to find the basic level of docs to
get going <sigh>)
I'd like to use only standard "built-in" modules if possible.
Could somebody offer a simple code-snippet to get me started reading from a
serial port?
Thanks!
|
by: George T. |
last post by:
I need to access the serial port via python on a windows machine.
Reading on the web, there are three solutions: pyserial, siomodule and
USPP. pyserial seems to be the best option since the other two are
tested with Windows 95 and older versions of python. Would you agree
with this or have I missed an option?
Can anyone provide me an example of how to access the serial port with
pyserial?
Thanks
|
by: xkenneth |
last post by:
Hi,
I'm writing a couple python applications that use the serial port
(RS-232) quite extensively. Is there any way I can monitor all activity
on the serial port and have it printed as the transactions occur? I'm
trying to reverse engineer a microcontroller serial routine and I'd
like to see any response the chip sends back.
Regards,
Ken
| |
by: pcm |
last post by:
Hi,
Has anyone ever worked on a Python-WinCE-based program that involved serial
port management ?
Regards,
Philippe
|
by: Rob |
last post by:
Hi all,
I am fairly new to python, but not programming and embedded. I am
having an issue which I believe is related to the hardware, triggered
by the software read I am doing in pySerial. I am sending a short
message to a group of embedded boxes daisy chained via the serial port.
When I send a 'global' message, all the connected units should reply
with their Id and Ack in this format '0 Ack' To be certain that I
didn't miss a...
|
by: rowan |
last post by:
I'm writing a driver in Python for an old fashioned piece of serial
equipment. Currently I'm using the USPP serial module. From what I can
see all the serial modules seem to set the timeout when you open a
serial port. This is not what I want to do. I need to change the
timeout each time I do a "read" on the serial port, depending on
which part of the protocol I've got to. Sometimes a return character
is expected within half a second,...
|
by: mmrasheed |
last post by:
Hi,
I am newbie in python. I am working on Telit GM862 GPS/GPRS module
which has python interpreter built in. But it seems this problem is
pretty much related to general python structure.
I need a promt/terminal when the device is connected to PC. If user
enters a command by serial port and press "Enter" then the data is
read by the device and work on the command. This is similar to
readline() function. Unfortunately there is no...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |