Hello all,

we usually do

   struct termios _options;
   ...
   _fh = [NSFileHandle fileHandleForUpdatingAtPath:@"/dev/term/a"];
   tcsetattr([_fh fileDescriptor], TCSADRAIN, &_options);
   [_fh writeData:...;

to access a serial port. GSFileHandle does

- (id) initForUpdatingAtPath: (NSString*)path
{
  int   d = open([path fileSystemRepresentation], O_RDWR | O_BINARY);
  ...
}

This approach works with the built-in serial ports on our Debian and Solaris boxes. Now we are using an EdgePort Device (USB-Serial-Adaptor) to add four additional serial ports to a Solaris machine. This device is natively supported by Solaris. A few seconds after plugging in the device we see the following devices

        /dev/term/0
        /dev/term/1
        /dev/term/2
        /dev/term/3

Cool so far. However, openening these devices with NSFileHandle does not work. The line [NSFileHandle fileHandleForUpdatingAtPath:@"/dev/term/0"] blocks (never returns). We have to do

   int fdes = open([device cString], O_RDWR | O_NDELAY);
_fh = [[NSFileHandle alloc] initWithFileDescriptor:fdes closeOnDealloc:YES];

instead. This works! Should this option be added to the GSFileHandle code? I did not figure out what exactly this option does. Insights would be greatly appreciated!

Thanks,

   Andreas




_______________________________________________
Discuss-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to