RE: [PECL-DEV] Serial port extension
| From: | Frank M. Kromann | Date: | Mon, 19 Jul 2004 23:38:29 +0000 |
| Subject: | RE: [PECL-DEV] Serial port extension | ||
| Groups: | php.pecl.dev | ||
| Request: | Send a blank email to pecl-dev+get-991@lists.php.net to get a copy of this message | ||
Hi Sergio,
The dio extension is not mine, I just fixed it so it would compile on
Win32. The extension is part of the php source three and you can get the
source files from the cvs repository or from one of the snapshots
(snaps.php.net).
With respect to adding O_NONBLOCK, thats a bit more complex. The dio
extension uses a generic api thats available on both unix and Windows with
functions like open(), read() and write(). The functions (CreateFile(),
ReadFile() and WriteFile()) in the article are only available on Win32.
I'll add an item on my (long) todo list to implement some of the missing
features.
- Frank
> Hi Frank,
> I'm testing your dio extension on Win2k and I noticed that the
O_NONBLOCK flag (sets non blocking mode, or overlapped I/O) is not
available. This way you can open a serial port (for example) only in
blocking mode or non-overlapped. As far as I understand from the Serial
Communication in Win32 tutorial
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfiles/html/msdn_serial.asp)
it should be almost easy to update the C code in order to make this feature
available. Could you update your extension or, if you could make the source
code available, I can help you to solve this problems?
> Thanx in advance
> best regards
> Sergio Paternoster
>
>
>
>
> -----Original Message-----
> From: Frank M. Kromann [mailto:frank@kromann.info]
> Sent: Thursday, 10 June, 2004 01:37
> To: Richard Thomas
> Cc: pecl-dev@lists.php.net; Paternoster Sergio
> Subject: Re: [PECL-DEV] Serial port extension
>
>
>
> dio is now available for windows in PHP5. You can use dio_open("COM1:",
> O_RDWR); to communicate with a serial port. I've tested it with both a
> normal serial port and the IR port in my laptop.
>
> It still need a bit of work and three functions are disabled on windows
> for now: dio_truncate(), dio_fcntl(), dio_tcsetattr().
>
> I'll include the extension in my builds at
> http://kromann.info/php5.php
> tomorrow.
>
> - Frank
>
> > I know how to remove windows quickly from any machine I get........
> >
> > Yes, I assume it should be pretty easy to update dio with more recent
> > baud numbers..
> >
> > The reason I suggested a seperate package for serial port coms, dio is
> > pretty unix/linux specific. Windows don't use file pointers/streams
for
>
> > device access.
> >
> > Hacking in ability to access a windows serial port into dio would be a
> > mess to say the least.
> >
> > So many of the dio functions just would not work in windows/would need
> > seperate windows versions.
> >
> > For example.. dio_open requires a filename, which would not be used in
> > windows.
> >
> > I don't think you could change dio without breaking backward compat.
> >
> > Richard Thomas
> > Cyberlot Technologies Group Inc.
> > 507.398.4124 - Voice
> >
> > Paternoster Sergio wrote:
> > > Yes, I see. Probably, the best idea is to add more features to the
> current dio release (honestly I don't know anything about windows so I
> cannot help you about that)
> > > regards
> > > Sergio
> > >
> > > -----Original Message-----
> > > From: Richard Thomas [mailto:lists@cyberlot.net]
> > > Sent: Wednesday, 09 June, 2004 15:44
> > > To: Paternoster Sergio
> > > Cc: pecl-dev@lists.php.net
> > > Subject: Re: [PECL-DEV] Serial port extension
> > >
> > >
> > > Hmm it seems the dio module does not accept 56700 baud at this time,
> > > 38400 is its max which clearly shows it hasn't been updated in a
> while...
> > >
> > > Also its linux specific, it should be possible to code something
> > > specific to serial ports that would work under both linux and
windows,
>
> > > although that part is beyond me at this time.
> > >
> > > Richard Thomas
> > > Cyberlot Technologies Group Inc.
> > > 507.398.4124 - Voice
> > >
> > > Paternoster Sergio wrote:
> > >
> > >>Hi Richard,
> > >>personally I think your extension is a good idea. Anyway only
little
> questions: what's the difference with dio(direct I/O) extension? What
> features are you including in it? I'm starting a little project to
control
> serial port voltage in C. Maybe we can join our efforts...
> > >>let me know
> > >>regards
> > >>Sergio Paternoster
> > >>
> > >>
> > >>
> > >>-----Original Message-----
> > >>From: Richard Thomas [mailto:lists@cyberlot.net]
> > >>Sent: Wednesday, 09 June, 2004 00:01
> > >>To: pecl-dev@lists.php.net
> > >>Subject: [PECL-DEV] Serial port extension
> > >>
> > >>
> > >>I have an extension for accessing the serial port that is about 60%
> done.
> > >>
> > >>It currently connects and reads from the serial port, This was all I
> > >>needed for a project I was working on but I figured since its mostly
> > >>done others might be able to work with it.
> > >>
> > >>Would this be something that would have a place in pecl? Anyone
> > >>interested in helping as my C is slightly rusty.
> >
> > --
> > PECL development discussion Mailing List (http://pecl.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
>