Displaying 2 results from an estimated 2 matches for "ser_open_error".
2008 Sep 24
2
[PATCH] disable nonblocking mode on serial port
...- nut-2.2.2/drivers/serial.c 2007-09-09 15:33:15.000000000 -0400
+++ nut-2.2.2-jim/drivers/serial.c 2008-09-24 16:55:32.000000000 -0400
@@ -133,12 +133,19 @@
int ser_open(const char *port)
{
int fd;
+ int flags;
fd = open(port, O_RDWR | O_NOCTTY | O_EXCL | O_NONBLOCK);
if (fd < 0)
ser_open_error(port);
+ if ((flags = fcntl(fd, F_GETFL, 0)) < 0)
+ ser_open_error(port);
+
+ if (fcntl(fd, F_SETFL, flags & ~O_NONBLOCK) < 0)
+ ser_open_error(port);
+
lock_set(fd, port);
return fd;
2009 Aug 14
2
Bestfortress driver, network serial patch for nut-2.0
...) {
+ strcpy(path,port);
+ p = strchr(path,':');
+ }
+ if (p != 0 && p != path) { /* open network port */
+ int netport = 0;
+ struct sockaddr_in saddr;
+ struct hostent *blob = 0;
+ *p++ = 0;
+ netport = atoi(p);
+ fd = socket(AF_INET, SOCK_STREAM, 0);
+ if (fd < 0)
+ ser_open_error("socket");
+ blob = gethostbyname(path);
+ if (blob == 0)
+ ser_open_error(path);
+ memcpy(&saddr.sin_addr,blob->h_addr,sizeof saddr.sin_addr);
+ saddr.sin_port = htons(netport);
+ saddr.sin_family = AF_INET;
+ if (connect(fd,(struct sockaddr *)&saddr,sizeof saddr)
+...