Beispiel #1
0
uTCHAR *js_name_device(int dev) {
	static uTCHAR name[128];
	uTCHAR path_dev[30];
	int fd;

	umemset(name, 0x00, usizeof(name));

	usnprintf(path_dev, usizeof(path_dev), uL("" JS_DEV_PATH "%d"), dev);
	fd = uopen(path_dev, O_RDONLY | O_NONBLOCK);

	if (uioctl(fd, JSIOCGNAME(sizeof(name)), name) < 0) {
		ustrncpy(name, uL("Not connected"), usizeof(name));
	}

	close(fd);

	return((uTCHAR *) name);
}
Beispiel #2
0
/* This function differs slightly from tcsetattr() in libc. */
int
tcsetattr(int fd, int action, struct termios *t)
{
	switch (action) {
	case TCSANOW:
		action = TIOCSETA;
		break;
	case TCSADRAIN:
		action = TIOCSETAW;
		break;
	case TCSAFLUSH:
		action = TIOCSETAF;
		break;
	default:
		errno = EINVAL;
		return (-1);
	}
	return (uioctl(fd, action, t));
}
Beispiel #3
0
int
tcgetattr(int fd, struct termios *t)
{
	return (uioctl(fd, TIOCGETA, t));
}