From 784257fe99509a96d12624ffc3ed8c9bdc465ed8 Mon Sep 17 00:00:00 2001 From: ppisa Date: Thu, 4 Mar 2004 18:38:59 +0000 Subject: [PATCH] Missing file added. --- lincan/src/ioctl_query.c | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 lincan/src/ioctl_query.c diff --git a/lincan/src/ioctl_query.c b/lincan/src/ioctl_query.c new file mode 100644 index 0000000..f562741 --- /dev/null +++ b/lincan/src/ioctl_query.c @@ -0,0 +1,46 @@ +/* ioctl_query.c + * Linux CAN-bus device driver. + * Written by Arnaud Westenberg email:arnaud@wanadoo.nl + * Rewritten for new CAN queues by Pavel Pisa - OCERA team member + * email:pisa@cmp.felk.cvut.cz + * This software is released under the GPL-License. + * Version lincan-0.2 9 Jul 2003 + */ + +#include "../include/can.h" +#include "../include/can_sysdep.h" +#include "../include/main.h" +#include "../include/ioctl.h" + + +/** + * can_ioctl_query - query for driver version and features + * @canuser: pointer to the user/client state structure + * @what: select which feature or version is queried + * + * Return Value: returns value for queried characteristic or -EINVAL + * if there is no reply to the query. + */ + +int can_ioctl_query(struct canuser_t *canuser, unsigned long what) +{ + switch(what){ + case CAN_DRV_QRY_BRANCH: + /* returns driver branch value - "LINC" for LinCAN driver */ + return CAN_DRV_BRANCH; + + case CAN_DRV_QRY_VERSION: + /* returns driver version as (major<<16) | (minor<<8) | patch */ + return CAN_DRV_VER; + + case CAN_DRV_QRY_MSGFORMAT: + /* format of canmsg_t structure */ + #ifdef CAN_MSG_VERSION_2 + return 2; + #else /*CAN_MSG_VERSION_2*/ + return 1; + #endif /*CAN_MSG_VERSION_2*/ + } + + return -EINVAL; +} -- 2.39.2