1 /**************************************************************************/
2 /* File: ioctl_queue.c - CAN driver parameters and versions queries */
4 /* LinCAN - (Not only) Linux CAN bus driver */
5 /* Copyright (C) 2002-2009 DCE FEE CTU Prague <http://dce.felk.cvut.cz> */
6 /* Copyright (C) 2002-2009 Pavel Pisa <pisa@cmp.felk.cvut.cz> */
7 /* Funded by OCERA and FRESCOR IST projects */
8 /* Based on CAN driver code by Arnaud Westenberg <arnaud@wanadoo.nl> */
10 /* LinCAN is free software; you can redistribute it and/or modify it */
11 /* under terms of the GNU General Public License as published by the */
12 /* Free Software Foundation; either version 2, or (at your option) any */
13 /* later version. LinCAN is distributed in the hope that it will be */
14 /* useful, but WITHOUT ANY WARRANTY; without even the implied warranty */
15 /* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */
16 /* General Public License for more details. You should have received a */
17 /* copy of the GNU General Public License along with LinCAN; see file */
18 /* COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, */
19 /* Cambridge, MA 02139, USA. */
21 /* To allow use of LinCAN in the compact embedded systems firmware */
22 /* and RT-executives (RTEMS for example), main authors agree with next */
23 /* special exception: */
25 /* Including LinCAN header files in a file, instantiating LinCAN generics */
26 /* or templates, or linking other files with LinCAN objects to produce */
27 /* an application image/executable, does not by itself cause the */
28 /* resulting application image/executable to be covered by */
29 /* the GNU General Public License. */
30 /* This exception does not however invalidate any other reasons */
31 /* why the executable file might be covered by the GNU Public License. */
32 /* Publication of enhanced or derived LinCAN files is required although. */
33 /**************************************************************************/
35 #include "../include/can.h"
36 #include "../include/can_sysdep.h"
37 #include "../include/main.h"
38 #include "../include/ioctl.h"
42 * can_ioctl_query - query for driver version and features
43 * @canuser: pointer to the user/client state structure
44 * @what: select which feature or version is queried
46 * Return Value: returns value for queried characteristic or -EINVAL
47 * if there is no reply to the query.
50 int can_ioctl_query(struct canuser_t *canuser, unsigned long what)
53 case CAN_DRV_QRY_BRANCH:
54 /* returns driver branch value - "LINC" for LinCAN driver */
55 return CAN_DRV_BRANCH;
57 case CAN_DRV_QRY_VERSION:
58 /* returns driver version as (major<<16) | (minor<<8) | patch */
61 case CAN_DRV_QRY_MSGFORMAT:
62 /* format of canmsg_t structure */
63 #ifdef CAN_MSG_VERSION_2
65 #else /*CAN_MSG_VERSION_2*/
67 #endif /*CAN_MSG_VERSION_2*/