
Hello, 1) I noticed there is no "open" function in Data.ByteString. So when I call writeFile or readFile is there an implicit open? 2) For both readFile and writeFile, the first parameter is of type FilePath (which is of course alliased to just String). In any case, for Windows and POSIX OS's like Linux can read and write to a serial device like RS232 by specfiying the device path, e.g. /dev/tty01? Thanks, Vasili

On 2009 Feb 26, at 18:50, Galchin, Vasili wrote:
1) I noticed there is no "open" function in Data.ByteString. So when I call writeFile or readFile is there an implicit open?
Correct; they're modeled after the writeFile and readFile functions in System.IO.
2) For both readFile and writeFile, the first parameter is of type FilePath (which is of course alliased to just String). In any case, for Windows and POSIX OS's like Linux can read and write to a serial device like RS232 by specfiying the device path, e.g. /dev/ tty01?
Only if the default port configuration is sufficient. You may need to use System.IO.Posix functions to set things up, then wrap in a Handle and pass to getContents. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH

hmmmm .... but at work I am surreptitiously writing in Haskell to test firmware and the platform in Windows XP, Brandon. So if I want something other than the default port configuration I am out of luck? (the default is 9600, ??,??,??)? Vasili On Thu, Feb 26, 2009 at 9:51 PM, Brandon S. Allbery KF8NH < allbery@ece.cmu.edu> wrote:
On 2009 Feb 26, at 18:50, Galchin, Vasili wrote:
1) I noticed there is no "open" function in Data.ByteString. So when I call writeFile or readFile is there an implicit open?
Correct; they're modeled after the writeFile and readFile functions in System.IO.
2) For both readFile and writeFile, the first parameter is of type FilePath (which is of course alliased to just String). In any case, for Windows and POSIX OS's like Linux can read and write to a serial device like RS232 by specfiying the device path, e.g. /dev/tty01?
Only if the default port configuration is sufficient. You may need to use System.IO.Posix functions to set things up, then wrap in a Handle and pass to getContents.
-- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH

On 2009 Feb 26, at 23:16, Galchin, Vasili wrote:
hmmmm .... but at work I am surreptitiously writing in Haskell to test firmware and the platform in Windows XP, Brandon. So if I want something other than the default port configuration I am out of luck? (the default is 9600, ??,??,??)?
I didn't mention how to do it on Windows because I have no idea how to do it. You can look in the Win32 hierarchy in the hierarchical libraries: http://www.haskell.org/ghc/docs/latest/html/libraries/index.html -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH

Hi Brandon, I have forgotten about RS232 protocol. Can I just reads and writes from the RS232 device from an application to handle data? Or do I need to handle RS232 protocol events in the application? Thanks, Vasili On Thu, Feb 26, 2009 at 10:30 PM, Brandon S. Allbery KF8NH < allbery@ece.cmu.edu> wrote:
On 2009 Feb 26, at 23:16, Galchin, Vasili wrote:
hmmmm .... but at work I am surreptitiously writing in Haskell to test firmware and the platform in Windows XP, Brandon. So if I want something other than the default port configuration I am out of luck? (the default is 9600, ??,??,??)?
I didn't mention how to do it on Windows because I have no idea how to do it. You can look in the Win32 hierarchy in the hierarchical libraries: http://www.haskell.org/ghc/docs/latest/html/libraries/index.html
-- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH

On 2009 Feb 26, at 23:45, Galchin, Vasili wrote:
I have forgotten about RS232 protocol. Can I just reads and writes from the RS232 device from an application to handle data? Or do I need to handle RS232 protocol events in the application?
Usually the OS handles protocol events, although you have to tell it what kind of events matter (carrier? does it use hardware flow control, ^S/^Q, or ETX/ACK?) I suggest heading to MSDN and digging up documentation on how serial devices work on Windows. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH

I already looked at MSDN examples and am not seriously enccouraged ;^( Vasili On Thu, Feb 26, 2009 at 10:51 PM, Brandon S. Allbery KF8NH < allbery@ece.cmu.edu> wrote:
On 2009 Feb 26, at 23:45, Galchin, Vasili wrote:
I have forgotten about RS232 protocol. Can I just reads and writes from the RS232 device from an application to handle data? Or do I need to handle RS232 protocol events in the application?
Usually the OS handles protocol events, although you have to tell it what kind of events matter (carrier? does it use hardware flow control, ^S/^Q, or ETX/ACK?) I suggest heading to MSDN and digging up documentation on how serial devices work on Windows.
-- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH

i.e. protocol events seem to "leak" into an application => yuck
On Thu, Feb 26, 2009 at 10:57 PM, Galchin, Vasili
I already looked at MSDN examples and am not seriously enccouraged ;^(
Vasili
On Thu, Feb 26, 2009 at 10:51 PM, Brandon S. Allbery KF8NH < allbery@ece.cmu.edu> wrote:
On 2009 Feb 26, at 23:45, Galchin, Vasili wrote:
I have forgotten about RS232 protocol. Can I just reads and writes from the RS232 device from an application to handle data? Or do I need to handle RS232 protocol events in the application?
Usually the OS handles protocol events, although you have to tell it what kind of events matter (carrier? does it use hardware flow control, ^S/^Q, or ETX/ACK?) I suggest heading to MSDN and digging up documentation on how serial devices work on Windows.
-- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH

On 2009 Feb 26, at 23:58, Galchin, Vasili wrote:
i.e. protocol events seem to "leak" into an application => yuck
On Thu, Feb 26, 2009 at 10:57 PM, Galchin, Vasili
wrote: I already looked at MSDN examples and am not seriously enccouraged ;^(
So, next stop: look for a serial library in C (or C++ with appropriate wrappers) for Win32 and make an FFI binding for it. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH

;^) On Thu, Feb 26, 2009 at 11:15 PM, Brandon S. Allbery KF8NH < allbery@ece.cmu.edu> wrote:
On 2009 Feb 26, at 23:58, Galchin, Vasili wrote:
i.e. protocol events seem to "leak" into an application => yuck
On Thu, Feb 26, 2009 at 10:57 PM, Galchin, Vasili
wrote: I already looked at MSDN examples and am not seriously enccouraged ;^(
So, next stop: look for a serial library in C (or C++ with appropriate wrappers) for Win32 and make an FFI binding for it.
-- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH

isn't this sufficient? might require some more Win32 bindings...
http://msdn.microsoft.com/en-us/library/ms810467.aspx
2009/2/27 Galchin, Vasili
;^)
On Thu, Feb 26, 2009 at 11:15 PM, Brandon S. Allbery KF8NH < allbery@ece.cmu.edu> wrote:
On 2009 Feb 26, at 23:58, Galchin, Vasili wrote:
i.e. protocol events seem to "leak" into an application => yuck
On Thu, Feb 26, 2009 at 10:57 PM, Galchin, Vasili
wrote: I already looked at MSDN examples and am not seriously enccouraged ;^(
So, next stop: look for a serial library in C (or C++ with appropriate wrappers) for Win32 and make an FFI binding for it.
-- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (3)
-
Brandon S. Allbery KF8NH
-
Galchin, Vasili
-
Peter Verswyvelen