src/gpio.c
/**
 * @brief Return control of userspace to kernel
 * 
 * Return control of userspace back to the kernel
 *
 * @param gpio GPIO pin number
 *
 * @return 0 on success, or -1 on failure and errno is set
 */
@brief Return control of userspace to kernel

Return control of userspace back to the kernel

@param gpio GPIO pin number

@return 0 on success, or -1 on failure and errno is set
@brief Return control of userspace to kernel Return control of userspace back to the kernel @param gpio GPIO pin number @return 0 on success or - 1 on failure and errno is set
int gpio_unexport(unsigned int gpio) {
	int fd, len;
	char buf[MAX_BUF];
	fd = gpio_fd_open(gpio, SYSFS_GPIO_UNEXPORT, O_WRONLY);
	if (fd < 0) {
		return fd;
	}
	len = sprintf(buf, "%d", gpio);
	write(fd, buf, len);
	close(fd);
	return 0;
}
int gpio_unexport ( unsigned int gpio ) { int fd , len ; char buf [ MAX_BUF ] ; fd = gpio_fd_open ( gpio , SYSFS_GPIO_UNEXPORT , O_WRONLY ) ; if ( fd < 0 ) { return fd ; } len = sprintf ( buf , " " , gpio ) ; write ( fd , buf , len ) ; close ( fd ) ; return 0 ; }
@brief Return control of userspace to kernel
@brief Return control of userspace to kernel