Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 36 lines (28 sloc) 0.592 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
#include <stdio.h>
#include <fcntl.h>
#include <asm-generic/ioctls.h>
#include <unistd.h>

/* Pulse DTR (Harvie 2o1o)
* This can be used eg.: for reseting Arduino
*
* make serial-pulse-dtr
* ./serial-pulse-dtr /dev/ttyUSB0
*
* (-; peace ;-)
*/

int main(int argc, char *argv[]) {
if(argc < 2) printf("Usage: %s [/dev/tty*]\n", argv[0]);

int fd = open(argv[1], O_WRONLY);
perror(argv[0]);

//DTR HIGH
//ioctl(fd, TIOCSDTR);
ioctl(fd, TIOCMBIS);

//Wait
//system("sleep 0.1");
usleep(100000);

//DTR LOW
//ioctl(fd, TIOCCDTR);
ioctl(fd, TIOCMBIC);

close(fd);
return 0;
}
Something went wrong with that request. Please try again.