]> rtime.felk.cvut.cz Git - lincan.git/blob - lincan/src/ioctl_query.c
Structured comments updated.
[lincan.git] / lincan / src / ioctl_query.c
1 /* ioctl_query.c
2  * Linux CAN-bus device driver.
3  * Written by Arnaud Westenberg email:arnaud@wanadoo.nl
4  * Rewritten for new CAN queues by Pavel Pisa - OCERA team member
5  * email:pisa@cmp.felk.cvut.cz
6  * This software is released under the GPL-License.
7  * Version lincan-0.2  9 Jul 2003
8  */
9
10 #include "../include/can.h"
11 #include "../include/can_sysdep.h"
12 #include "../include/main.h"
13 #include "../include/ioctl.h"
14
15
16 /**
17  * can_ioctl_query - query for driver version and features
18  * @canuser: pointer to the user/client state structure
19  * @what:    select which feature or version is queried
20  *
21  * Return Value: returns value for queried characteristic or -EINVAL
22  *      if there is no reply to the query.
23  */
24
25 int can_ioctl_query(struct canuser_t *canuser, unsigned long what)
26 {
27         switch(what){
28                 case CAN_DRV_QRY_BRANCH:
29                         /* returns driver branch value - "LINC" for LinCAN driver */
30                         return CAN_DRV_BRANCH;
31
32                 case CAN_DRV_QRY_VERSION:
33                         /* returns driver version as (major<<16) | (minor<<8) | patch */
34                         return CAN_DRV_VER;
35
36                 case CAN_DRV_QRY_MSGFORMAT:
37                         /* format of canmsg_t structure */
38                         #ifdef CAN_MSG_VERSION_2
39                           return 2;
40                         #else /*CAN_MSG_VERSION_2*/
41                           return 1;
42                         #endif /*CAN_MSG_VERSION_2*/
43         }
44
45         return -EINVAL;
46 }