Ticket #22867: patch-ser_posix.c.diff
File patch-ser_posix.c.diff, 1.3 KB (added by ranauei@…, 15 years ago) |
---|
-
ser_posix.c
old new 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 20 21 /* $Id: ser_posix.c 8 26 2009-07-02 10:31:13Z joerg_wunsch$ */21 /* $Id: ser_posix.c 845 2009-10-10 01:41:40Z mludvig $ */ 22 22 23 23 /* 24 24 * Posix serial interface for avrdude. … … 32 32 #include <stdlib.h> 33 33 #include <string.h> 34 34 #include <errno.h> 35 #include <sys/ioctl.h> 35 36 #include <sys/types.h> 36 37 #include <sys/time.h> 37 38 #include <sys/socket.h> … … 210 211 fdp->ifd = fd; 211 212 } 212 213 214 215 static int ser_set_dtr_rts(union filedescriptor *fdp, int is_on) 216 { 217 unsigned int ctl; 218 int r; 219 220 r = ioctl(fdp->ifd, TIOCMGET, &ctl); 221 if (r < 0) { 222 perror("ioctl(\"TIOCMGET\")"); 223 return -1; 224 } 225 226 if (is_on) { 227 /* Clear DTR and RTS */ 228 ctl &= ~(TIOCM_DTR | TIOCM_RTS); 229 } 230 else { 231 /* Set DTR and RTS */ 232 ctl |= (TIOCM_DTR | TIOCM_RTS); 233 } 234 235 r = ioctl(fdp->ifd, TIOCMSET, &ctl); 236 if (r < 0) { 237 perror("ioctl(\"TIOCMSET\")"); 238 return -1; 239 } 240 241 return 0; 242 } 243 213 244 static void ser_open(char * port, long baud, union filedescriptor *fdp) 214 245 { 215 246 int rc; … … 455 486 .send = ser_send, 456 487 .recv = ser_recv, 457 488 .drain = ser_drain, 489 .set_dtr_rts = ser_set_dtr_rts, 458 490 .flags = SERDEV_FL_CANSETSPEED, 459 491 }; 460 492