- Add log messages to open, close and configuration functon.
- Remove log messages in read and write function to prevent log
spam.
Change-Id: Ie26d8335ba4633a9d4fd039bc5dd28c5d968bab4
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
int fd, len, status;
char gpio_export[GPIO_BUFFER_MAX] = {0, };
+ _D("gpiopin : %d", gpiopin);
+
fd = open(SYSFS_GPIO_DIR "/export", O_WRONLY);
if (fd < 0) {
char errmsg[MAX_ERR_LEN];
int fd, status;
char gpio_dev[GPIO_BUFFER_MAX] = {0, };
+ _D("gpiopin : %d, dir : %d", gpiopin, dir);
+
snprintf(gpio_dev, GPIO_BUFFER_MAX, SYSFS_GPIO_DIR"/gpio%d/direction", gpiopin);
fd = open(gpio_dev, O_WRONLY);
if (fd < 0) {
int fd, status;
char gpio_dev[GPIO_BUFFER_MAX] = {0, };
+ _D("gpiopin : %d, edge : %d", gpiopin, edge);
+
snprintf(gpio_dev, GPIO_BUFFER_MAX, SYSFS_GPIO_DIR"/gpio%d/edge", gpiopin);
fd = open(gpio_dev, O_WRONLY);
if (fd < 0) {
int fd, len, status;
char gpio_unexport[GPIO_BUFFER_MAX] = {0, };
+ _D("gpiopin : %d", gpiopin);
+
fd = open(SYSFS_GPIO_DIR "/unexport", O_WRONLY);
if (fd < 0) {
char errmsg[MAX_ERR_LEN];
int new_fd;
char i2c_dev[I2C_BUFFER_MAX] = {0,};
+ _D("bus : %d", bus);
+
snprintf(i2c_dev, sizeof(i2c_dev)-1, SYSFS_I2C_DIR"-%d", bus);
new_fd = open(i2c_dev, O_RDWR);
{
int status;
- if (fd < 0) return -EINVAL;
+ _D("fd : %d", fd);
+ if (fd < 0) return -EINVAL;
status = close(fd);
if (status < 0) {
{
int status;
- _D("slave address : %x", address);
+ _D("slave address : 0x%x", address);
+
status = ioctl(fd, I2C_SLAVE, address);
if (status < 0) {
{
int status;
- _D("fd : %d, length : %d", fd, length);
status = read(fd, data, length);
if (status != length) {
{
int status;
- _D("fd : %d, length : %d", fd, length);
status = write(fd, data, length);
if (status != length) {
{
int status;
- _D("fd : %d", fd);
status = ioctl(fd, I2C_SMBUS, data);
if (status < 0) {
char errmsg[MAX_ERR_LEN];
char pwm_dev[PATH_BUF_MAX] = {0};
char pwm_buf[PWM_BUF_MAX] = {0};
+ _D("device : %d, channel : %d", device, channel);
+
snprintf(pwm_dev, PATH_BUF_MAX, SYSFS_PWM_PATH "/pwmchip%d/export", device);
fd = open(pwm_dev, O_WRONLY);
if (fd < 0) {
char pwm_dev[PATH_BUF_MAX] = {0};
char pwm_buf[PWM_BUF_MAX] = {0};
+ _D("device : %d, channel : %d", device, channel);
+
snprintf(pwm_dev, PATH_BUF_MAX, SYSFS_PWM_PATH "/pwmchip%d/unexport", device);
fd = open(pwm_dev, O_WRONLY);
if (fd < 0) {
char pwm_buf[PWM_BUF_MAX] = {0};
char pwm_dev[PATH_BUF_MAX] = {0};
- _D("Set period : %d, device : %d, channel : %d", period, device, channel);
+ _D("device : %d, channel : %d, period : %d", device, channel, period);
+
snprintf(pwm_dev, PATH_BUF_MAX, SYSFS_PWM_PATH "/pwmchip%d/pwm%d/period", device, channel);
fd = open(pwm_dev, O_WRONLY);
if (fd < 0) {
char pwm_buf[PWM_BUF_MAX] = {0};
char pwm_dev[PATH_BUF_MAX] = {0};
- _D("Set duty_cycle : %d, device : %d, channel : %d", duty_cycle, device, channel);
+ _D("device : %d, channel : %d, duty_cycle : %d", device, channel, duty_cycle);
+
snprintf(pwm_dev, PATH_BUF_MAX, SYSFS_PWM_PATH "/pwmchip%d/pwm%d/duty_cycle", device, channel);
fd = open(pwm_dev, O_WRONLY);
if (fd < 0) {
int fd, status;
char pwm_dev[PATH_BUF_MAX] = {0};
- _D("Set polarity : %d, device : %d, channel : %d", polarity, device, channel);
+ _D("device : %d, channel : %d, polarity : %d", device, channel, polarity);
+
snprintf(pwm_dev, PATH_BUF_MAX, SYSFS_PWM_PATH "/pwmchip%d/pwm%d/polarity", device, channel);
fd = open(pwm_dev, O_WRONLY);
if (fd < 0) {
char pwm_buf[PWM_BUF_MAX] = {0};
char pwm_dev[PATH_BUF_MAX] = {0};
- _D("Set enable : %d, device : %d, channel : %d", enable, device, channel);
+ _D("device : %d, channel : %d, enable : %d", device, channel, enable);
+
snprintf(pwm_dev, PATH_BUF_MAX, SYSFS_PWM_PATH "/pwmchip%d/pwm%d/enable", device, channel);
fd = open(pwm_dev, O_WRONLY);
if (fd < 0) {
int new_fd = 0;
char spi_dev[SPI_BUFFER_MAX] = {0,};
+ _D("bus : %d, cs : %d", bus, cs);
+
snprintf(spi_dev, sizeof(spi_dev)-1, SYSFS_SPI_DIR"%d.%d", bus, cs);
new_fd = open(spi_dev, O_RDWR);
{
int status;
+ _D("fd : %d", fd);
+
if (fd < 0) return -EINVAL;
status = close(fd);
{
int status;
+ _D("fd : %d, mode : %d", fd, mode);
+
if (fd < 0) return -EINVAL;
_D("Set mode : %d", mode);
{
int status;
+ _D("fd : %d, lsb : %d", fd, lsb);
+
if (fd < 0) return -EINVAL;
_D("Set lsb first : %d", lsb);
{
int status;
+ _D("fd : %d, bits : %d", fd, bits);
+
if (fd < 0) return -EINVAL;
_D("Set bit per word : %d", bits);
{
int status;
+ _D("fd : %d, freq : %d", fd, freq);
+
if (fd < 0) return -EINVAL;
_D("Set frequency : %d", freq);
int fd;
char fName[PATH_BUF_MAX] = {0};
+ _D("port : %d", port);
+
snprintf(fName, PATH_BUF_MAX, SYSFS_UART_PATH "%d", port);
if ((fd = open(fName, O_RDWR | O_NOCTTY | O_NONBLOCK)) < 0) {
_E("Error[%d]: can't open %s, %s--[%d]\n", errno, fName, __FUNCTION__, __LINE__);
int uart_close(int file_hndl)
{
+ _D("file_hndl : %d", file_hndl);
+
if (!file_hndl) {
_E("Error[%d]: Invalid parameter, %s--[%d]\n", errno, __FUNCTION__, __LINE__);
return -EINVAL;
int uart_flush(int file_hndl)
{
int ret;
+
if (!file_hndl) {
_E("Error[%d]: Invalid parameter, %s--[%d]\n", errno, __FUNCTION__, __LINE__);
return -EINVAL;
int ret;
struct termios tio;
+ _D("file_hndl : %d, baud : %d", file_hndl, baud);
+
memset(&tio, 0, sizeof(tio));
if (!file_hndl) {
_E("Error[%d]: Invalid parameter, %s--[%d]\n", errno, __FUNCTION__, __LINE__);
int ret;
struct termios tio;
+ _D("file_hndl : %d, bytesize : %d, parity : %d, stopbits : %d", file_hndl, bytesize, parity, stopbits);
+
if (!file_hndl) {
_E("Error[%d]: Invalid parameter, %s--[%d]\n", errno, __FUNCTION__, __LINE__);
return -EINVAL;
int ret;
struct termios tio;
+ _D("file_hndl : %d, xonxoff : %d, rtscts : %d", file_hndl, xonxoff, rtscts);
+
if (!file_hndl) {
_E("Error[%d]: Invalid parameter, %s--[%d]\n", errno, __FUNCTION__, __LINE__);
return -EINVAL;