From 755ac09a8ab107ad07cf60cd272a67c83a3a14cb Mon Sep 17 00:00:00 2001 From: etisserant Date: Wed, 4 Jun 2008 08:59:09 +0000 Subject: [PATCH 1/1] Applied James patch that fixes can_cn4linux.c file descriptor handling and make it compatible with can_serial_hub. --- drivers/can_can4linux/can_can4linux.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/can_can4linux/can_can4linux.c b/drivers/can_can4linux/can_can4linux.c index 093d49c..cc949b6 100755 --- a/drivers/can_can4linux/can_can4linux.c +++ b/drivers/can_can4linux/can_can4linux.c @@ -168,7 +168,7 @@ CAN_HANDLE canOpen_driver(s_BOARD *board) dev_name[prefix_len+name_len] = 0; fd0 = open(dev_name, O_RDWR|o_flags); - if(fd0 <= 0){ + if(fd0 == -1){ fprintf(stderr,"!!! %s is unknown. See can4linux.c\n", dev_name); goto error_ret; } @@ -192,8 +192,16 @@ CAN_HANDLE canOpen_driver(s_BOARD *board) /***************************************************************************/ int canClose_driver(CAN_HANDLE fd0) { - if((int)fd0<=0) - return -1; - close(fd0); - return 0; + if((int)fd0 != -1) { + return close((int)fd0); + } + + return -1; +} + +int canfd_driver(CAN_HANDLE fd0) +{ + return ((int)fd0); } + + -- 2.39.2