Example #1
0
func New(port string, baud int) (*os.File, error) {
	fd := int(C.serial_open(C.CString(port), C.int(baud)))
	if fd == -1 {
		return nil, os.ErrPermission
	}
	return os.NewFile(uintptr(fd), port), nil
}
Example #2
0
func New(port string, baud int) (*os.File, error) {
	fd := int(C.serial_open(C.CString(port), C.int(baud)))
	if fd == -1 {
		return nil, os.EACCES
	}
	return os.NewFile(fd, port), nil
}