[PythonCE] serial port access
Tom Galvin
TGalvin at geminidataloggers.com
Wed Jun 21 12:28:57 CEST 2006
Hi Benjamin
We have achieved serial port access by applying the following patches to
the build. I would be interested in any success you have using other
methods.
- Apply the following patch to
PYTHONCEROOT\\PCbuild\\WinCE\\External-Components\\PyWin32\makefile
19c19,20
wince
---
wince \
win32file
76a77,84
# win32file:
#
win32file:
@cd ..\..
@$(NMAKE) -f External-Components\PyWin32\makefile.win32file
SWIGROOT=$(SWIGROOT)
@cd External-Components\PyWin32
#
84a93
@$(NMAKE) -f External-Components\PyWin32\makefile.win32file
clean
- Add the attached makefile.win32file to
PYTHONCEROOT\\PCbuild\\WinCE\\External-Components\\PyWin32
- Add the attached win32file_comm_wince.cpp and
win32filemodule_wince.cpp source files to PYWIN32ROOT\\win32\\src
- Add an empty file `io.h` to
PYTHONCEROOT\\PC\\WinCE
Regards
Tom
>>-----Original Message-----
>>From: pythonce-bounces at python.org [mailto:pythonce-bounces at python.org]
On
>>Behalf Of pythonce-request at python.org
>>Sent: 21 June 2006 11:00
>>To: pythonce at python.org
>>Subject: PythonCE Digest, Vol 35, Issue 8
>>
>>Send PythonCE mailing list submissions to
>> pythonce at python.org
>>
>>To subscribe or unsubscribe via the World Wide Web, visit
>> http://mail.python.org/mailman/listinfo/pythonce
>>or, via email, send a message with subject or body 'help' to
>> pythonce-request at python.org
>>
>>You can reach the person managing the list at
>> pythonce-owner at python.org
>>
>>When replying, please edit your Subject line so it is more specific
>>than "Re: Contents of PythonCE digest..."
>>
>>
>>Today's Topics:
>>
>> 1. serial port access (Benjamin McBride)
>> 2. Re: serial port access (Gonzalo Monz?n)
>> 3. Re: serial port access (Benjamin McBride)
>> 4. Re: serial port access (Gonzalo Monz?n)
>> 5. Re: serial port access (Benjamin McBride)
>>
>>
>>----------------------------------------------------------------------
>>
>>Message: 1
>>Date: Tue, 20 Jun 2006 10:20:05 -0500
>>From: "Benjamin McBride" <benjamin.mcbride at gmail.com>
>>Subject: [PythonCE] serial port access
>>To: pythonce at python.org
>>Message-ID:
>> <c1211b170606200820w22f7d7bat408897dbab5d4e2 at mail.gmail.com>
>>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>
>> Hi All,
>>
>> I need to access the serial port for my PPC application. I have
been
>> unable to locate information on this. I'm using Python 2.4.3 and
PPC
>> 2003. Previously I've used pyserial, but it appears that
pyserial
>>does
>> not work on Windows CE.
>>
>> Thanks for any suggestions,
>>
>> Ben McBride
>> bdm7935 at ksu.edu
>>
>>
>>------------------------------
>>
>>Message: 2
>>Date: Tue, 20 Jun 2006 18:09:28 +0200
>>From: Gonzalo Monz?n <gmc at serveisw3.net>
>>Subject: Re: [PythonCE] serial port access
>>To: Benjamin McBride <benjamin.mcbride at gmail.com>
>>Cc: pythonce at python.org
>>Message-ID: <44981DB8.4050502 at serveisw3.net>
>>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>
>>Hi Benjamin,
>>
>>You can use ctypes for direct access to serial ports via windows apis
>>(openfile, readfile, writefile...)
>>
>>Note that manufacturers can have specific implementations, even they
>>must agree to PPC implementation, but you can found small differences.
>>
>>http://www.codeproject.com/system/simpleserialcomm.asp
>>
>>Regards,
>>Gonzalo
>>
>>
>>Benjamin McBride escribi?:
>>
>>> Hi All,
>>>
>>> I need to access the serial port for my PPC application. I have
>>been
>>> unable to locate information on this. I'm using Python 2.4.3
and
>>PPC
>>> 2003. Previously I've used pyserial, but it appears that
pyserial
>>does
>>> not work on Windows CE.
>>>
>>> Thanks for any suggestions,
>>>
>>> Ben McBride
>>> bdm7935 at ksu.edu
>>>_______________________________________________
>>>PythonCE mailing list
>>>PythonCE at python.org
>>>http://mail.python.org/mailman/listinfo/pythonce
>>>
>>>
>>>
>>
>>
>>
>>------------------------------
>>
>>Message: 3
>>Date: Tue, 20 Jun 2006 15:11:34 -0500
>>From: "Benjamin McBride" <benjamin.mcbride at gmail.com>
>>Subject: Re: [PythonCE] serial port access
>>To: pythonce at python.org
>>Message-ID:
>> <c1211b170606201311r26990525n3d6b1236abd87db9 at mail.gmail.com>
>>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>
>>I've got ctypes installed. However, I have not been able to find any
>>examples of how I might use ctypes for serial port access. Any
>>suggestions would be appreciated.
>>
>>Thanks,
>>
>>Ben
>>
>>On 6/20/06, Gonzalo Monz?n <gmc at serveisw3.net> wrote:
>>> Hi Benjamin,
>>>
>>> You can use ctypes for direct access to serial ports via windows
apis
>>> (openfile, readfile, writefile...)
>>>
>>> Note that manufacturers can have specific implementations, even they
>>> must agree to PPC implementation, but you can found small
differences.
>>>
>>> http://www.codeproject.com/system/simpleserialcomm.asp
>>>
>>> Regards,
>>> Gonzalo
>>>
>>>
>>> Benjamin McBride escribi?:
>>>
>>> > Hi All,
>>> >
>>> > I need to access the serial port for my PPC application. I
have
>>been
>>> > unable to locate information on this. I'm using Python 2.4.3
and
>>PPC
>>> > 2003. Previously I've used pyserial, but it appears that
pyserial
>>does
>>> > not work on Windows CE.
>>> >
>>> > Thanks for any suggestions,
>>> >
>>> > Ben McBride
>>> > bdm7935 at ksu.edu
>>> >_______________________________________________
>>> >PythonCE mailing list
>>> >PythonCE at python.org
>>> >http://mail.python.org/mailman/listinfo/pythonce
>>> >
>>> >
>>> >
>>>
>>>
>>
>>
>>------------------------------
>>
>>Message: 4
>>Date: Tue, 20 Jun 2006 22:42:02 +0200
>>From: Gonzalo Monz?n <gmc at serveisw3.net>
>>Subject: Re: [PythonCE] serial port access
>>To: Benjamin McBride <benjamin.mcbride at gmail.com>
>>Cc: pythonce at python.org
>>Message-ID: <44985D9A.5030305 at serveisw3.net>
>>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>
>>Have you read the ctypes docs?
>>
>>http://starship.python.net/crew/theller/ctypes/tutorial.html
>>
>>You have to read the Microsoft docs too, search what dynamic libraries
>>to use and what functions to call. Study the example I posted, you
have
>>to call these functions using ctypes:
>>
>>(openfile, readfile, writefile...)
>>
>>Don't know if somebody has implemented serial access using ctypes as
to
>>post an example, read the docs, first you need to understand how
ctypes
>>work -for that you should know or learn what C variable types are and
>>understand it almost a little bit, then the codeproject example will
>>come in handy- otherwise could be hard to code... Though any ctypes
>>example handling file or stream data may help you. Though pyserial
uses
>>ctypes too, so you could have a look to the sources. The differences
are
>>you have to use straight windows api calls, and pyserial calls a
helper
>>library wich should use windows api's for windows platform.
>>
>>I have to code serial access too in the next weeks, but don't have the
>>time now to get my hands in it. If you are not in hurry I could post
an
>>example when done.
>>
>>Gonzalo.
>>
>>
>>Benjamin McBride escribi?:
>>
>>>I've got ctypes installed. However, I have not been able to find any
>>>examples of how I might use ctypes for serial port access. Any
>>>suggestions would be appreciated.
>>>
>>>Thanks,
>>>
>>>Ben
>>>
>>>On 6/20/06, Gonzalo Monz?n <gmc at serveisw3.net> wrote:
>>>
>>>
>>>>Hi Benjamin,
>>>>
>>>>You can use ctypes for direct access to serial ports via windows
apis
>>>>(openfile, readfile, writefile...)
>>>>
>>>>Note that manufacturers can have specific implementations, even they
>>>>must agree to PPC implementation, but you can found small
differences.
>>>>
>>>>http://www.codeproject.com/system/simpleserialcomm.asp
>>>>
>>>>Regards,
>>>>Gonzalo
>>>>
>>>>
>>>>Benjamin McBride escribi?:
>>>>
>>>>
>>>>
>>>>> Hi All,
>>>>>
>>>>> I need to access the serial port for my PPC application. I
have
>>been
>>>>> unable to locate information on this. I'm using Python 2.4.3
and
>>PPC
>>>>> 2003. Previously I've used pyserial, but it appears that
pyserial
>>does
>>>>> not work on Windows CE.
>>>>>
>>>>> Thanks for any suggestions,
>>>>>
>>>>> Ben McBride
>>>>> bdm7935 at ksu.edu
>>>>>_______________________________________________
>>>>>PythonCE mailing list
>>>>>PythonCE at python.org
>>>>>http://mail.python.org/mailman/listinfo/pythonce
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>_______________________________________________
>>>PythonCE mailing list
>>>PythonCE at python.org
>>>http://mail.python.org/mailman/listinfo/pythonce
>>>
>>>
>>>
>>
>>
>>
>>------------------------------
>>
>>Message: 5
>>Date: Tue, 20 Jun 2006 15:54:18 -0500
>>From: "Benjamin McBride" <benjamin.mcbride at gmail.com>
>>Subject: Re: [PythonCE] serial port access
>>To: pythonce at python.org
>>Message-ID:
>> <c1211b170606201354r24ccbc1by38cd3ac3da6a5ad1 at mail.gmail.com>
>>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>
>>Thanks Gonzalo for your help. I have read both the ctypes and
>>microsoft documentation. My understanding is that I need to use the
>>CreateFile API function from the coredll to get a handle to the comm
>>port. When I use ctypes:
>>
>>>>> windll.coredll.CreateFile
>>
>>I get an AttributeError saying the CreateFile function is not found.
>>Ironically, the ReadFile, WriteFile, and CloseHandle functions are all
>>found.
>>
>>Am I just missing something simple here?
>>
>>Ben
>>
>>On 6/20/06, Gonzalo Monz?n <gmc at serveisw3.net> wrote:
>>> Have you read the ctypes docs?
>>>
>>> http://starship.python.net/crew/theller/ctypes/tutorial.html
>>>
>>> You have to read the Microsoft docs too, search what dynamic
libraries
>>> to use and what functions to call. Study the example I posted, you
have
>>> to call these functions using ctypes:
>>>
>>> (openfile, readfile, writefile...)
>>>
>>> Don't know if somebody has implemented serial access using ctypes as
to
>>> post an example, read the docs, first you need to understand how
ctypes
>>> work -for that you should know or learn what C variable types are
and
>>> understand it almost a little bit, then the codeproject example will
>>> come in handy- otherwise could be hard to code... Though any ctypes
>>> example handling file or stream data may help you. Though pyserial
uses
>>> ctypes too, so you could have a look to the sources. The differences
are
>>> you have to use straight windows api calls, and pyserial calls a
helper
>>> library wich should use windows api's for windows platform.
>>>
>>> I have to code serial access too in the next weeks, but don't have
the
>>> time now to get my hands in it. If you are not in hurry I could post
an
>>> example when done.
>>>
>>> Gonzalo.
>>>
>>>
>>> Benjamin McBride escribi?:
>>>
>>> >I've got ctypes installed. However, I have not been able to find
any
>>> >examples of how I might use ctypes for serial port access. Any
>>> >suggestions would be appreciated.
>>> >
>>> >Thanks,
>>> >
>>> >Ben
>>> >
>>> >On 6/20/06, Gonzalo Monz?n <gmc at serveisw3.net> wrote:
>>> >
>>> >
>>> >>Hi Benjamin,
>>> >>
>>> >>You can use ctypes for direct access to serial ports via windows
apis
>>> >>(openfile, readfile, writefile...)
>>> >>
>>> >>Note that manufacturers can have specific implementations, even
they
>>> >>must agree to PPC implementation, but you can found small
differences.
>>> >>
>>> >>http://www.codeproject.com/system/simpleserialcomm.asp
>>> >>
>>> >>Regards,
>>> >>Gonzalo
>>> >>
>>> >>
>>> >>Benjamin McBride escribi?:
>>> >>
>>> >>
>>> >>
>>> >>> Hi All,
>>> >>>
>>> >>> I need to access the serial port for my PPC application. I
have
>>been
>>> >>> unable to locate information on this. I'm using Python 2.4.3
and
>>PPC
>>> >>> 2003. Previously I've used pyserial, but it appears that
>>pyserial does
>>> >>> not work on Windows CE.
>>> >>>
>>> >>> Thanks for any suggestions,
>>> >>>
>>> >>> Ben McBride
>>> >>> bdm7935 at ksu.edu
>>> >>>_______________________________________________
>>> >>>PythonCE mailing list
>>> >>>PythonCE at python.org
>>> >>>http://mail.python.org/mailman/listinfo/pythonce
>>> >>>
>>> >>>
>>> >>>
>>> >>>
>>> >>>
>>> >>
>>> >>
>>> >_______________________________________________
>>> >PythonCE mailing list
>>> >PythonCE at python.org
>>> >http://mail.python.org/mailman/listinfo/pythonce
>>> >
>>> >
>>> >
>>>
>>>
>>
>>
>>------------------------------
>>
>>_______________________________________________
>>PythonCE mailing list
>>PythonCE at python.org
>>http://mail.python.org/mailman/listinfo/pythonce
>>
>>
>>End of PythonCE Digest, Vol 35, Issue 8
>>***************************************
____________________
Important Notice:
This email and any attachments are confidential and may contain trade secrets or be legally privileged. If you have received this email in error you must not use, rely upon, disclose, copy or distribute the contents. Please reply to the sender so that proper delivery can be arranged and delete the email from your computer.
Gemini Data Loggers monitor incoming and outgoing email to ensure satisfactory customer service, maintain company security and prevent abuse of their email system. However, any views expressed in this email are not necessarily those of Gemini and Gemini cannot be held responsible for the content.
Gemini makes best efforts to ensure emails are virus free; however you are advised to carry out your own checks. Gemini does not accept responsibility for any damage resulting from email viruses.
____________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: makefile.win32file
Type: application/octet-stream
Size: 710 bytes
Desc: makefile.win32file
Url : http://mail.python.org/pipermail/pythonce/attachments/20060621/2d1b2348/attachment-0003.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: win32filemodule_wince.cpp
Type: application/octet-stream
Size: 60466 bytes
Desc: win32filemodule_wince.cpp
Url : http://mail.python.org/pipermail/pythonce/attachments/20060621/2d1b2348/attachment-0004.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: win32file_comm_wince.cpp
Type: application/octet-stream
Size: 13862 bytes
Desc: win32file_comm_wince.cpp
Url : http://mail.python.org/pipermail/pythonce/attachments/20060621/2d1b2348/attachment-0005.obj
More information about the PythonCE
mailing list