2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Please note that the comments on this file may be out of date
7 * and that they represent what I have figured about the shmiq device
10 * This also contains some streams and idev bits.
12 * They may contain errors, please, refer to the source code of the Linux
13 * kernel for a definitive answer on what we have implemented
21 #define STRIOC ('S' << 8)
22 #define I_STR (STRIOC | 010)
23 #define I_PUSH (STRIOC | 02)
24 #define I_LINK (STRIOC | 014)
25 #define I_UNLINK (STRIOC | 015)
27 /* Data structure passed on I_STR ioctls */
29 int ic_cmd; /* streams ioctl command */
30 int ic_timout; /* timeout */
31 int ic_len; /* lenght of data */
32 void *ic_dp; /* data */
36 * For mapping the shared memory input queue, you have to:
38 * 1. Map /dev/zero for the number of bytes you want to use
39 * for your shared memory input queue plus the size of the
40 * sharedMemoryInputQueue structure + 4 (I still have not figured
41 * what this one is for
45 * 3. Open /dev/qcntlN N is [0..Nshmiqs]
47 * 4. Fill a shmiqreq structure. user_vaddr should point to the return
48 * address from the /dev/zero mmap. Arg is the number of shmqevents
49 * that fit into the /dev/zero region (remember that at the beginning there
50 * is a sharedMemoryInputQueue header).
52 * 5. Issue the ioctl (qcntlfd, QIOCATTACH, &your_shmiqreq);
60 /* map the shmiq into the process address space */
61 #define QIOCATTACH _IOW('Q',1,struct shmiqreq)
64 #define QIOCDETACH _IO('Q',2)
67 * A shared memory input queue event.
70 unsigned char device; /* device major */
71 unsigned char which; /* device minor */
72 unsigned char type; /* event type */
73 unsigned char flags; /* little event data */
75 int pos; /* big event data */
76 short ptraxis [2]; /* event data for PTR events */
80 /* indetifies the shmiq and the device */
89 struct shmiqlinkid id;
91 struct shmqdata data ;
95 * sharedMemoryInputQueue: this describes the shared memory input queue.
97 * head is the user index into the events, user can modify this one.
98 * tail is managed by the kernel.
99 * flags is one of SHMIQ_OVERFLOW or SHMIQ_CORRUPTED
100 * if OVERFLOW is set it seems ioctl QUIOCSERVICED should be called
101 * to notify the kernel.
102 * events where the kernel sticks the events.
104 struct sharedMemoryInputQueue {
105 volatile int head; /* user's index into events */
106 volatile int tail; /* kernel's index into events */
107 volatile unsigned int flags; /* place for out-of-band data */
108 #define SHMIQ_OVERFLOW 1
109 #define SHMIQ_CORRUPTED 2
110 struct shmqevent events[1]; /* input event buffer */
113 /* have to figure this one out */
114 #define QIOCGETINDX _IOWR('Q', 8, int)
117 /* acknowledge shmiq overflow */
118 #define QIOCSERVICED _IO('Q', 3)
120 /* Double indirect I_STR ioctl, yeah, fun fun fun */
123 int index; /* lower stream index */
124 int realcmd; /* the actual command for the subdevice */
126 /* Double indirect ioctl */
127 #define QIOCIISTR _IOW('Q', 7, struct muxioctl)
131 /* set cursor tracking mode */
132 #define QIOCURSTRK _IOW('Q', 4, int)
134 /* set cursor filter box */
135 #define QIOCURSIGN _IOW('Q', 5, int [4])
137 /* set cursor axes */
138 struct shmiqsetcurs {
143 #define QIOCSETCURS _IOWR('Q', 9, struct shmiqsetcurs)
145 /* set cursor position */
146 struct shmiqsetcpos {
150 #define QIOCSETCPOS _IOWR('Q', 10, struct shmiqsetcpos)
152 /* get time since last event */
153 #define QIOCGETITIME _IOR('Q', 11, time_t)
155 /* set current screen */
156 #define QIOCSETSCRN _IOW('Q',6,int)
159 /* -------------------- iDev stuff -------------------- */
161 #define IDEV_MAX_NAME_LEN 15
162 #define IDEV_MAX_TYPE_LEN 15
165 char devName[IDEV_MAX_NAME_LEN+1];
166 char devType[IDEV_MAX_TYPE_LEN+1];
167 unsigned short nButtons;
168 unsigned short nValuators;
169 unsigned short nLEDs;
170 unsigned short nStrDpys;
171 unsigned short nIntDpys;
172 unsigned char nBells;
174 #define IDEV_HAS_KEYMAP 0x01
175 #define IDEV_HAS_PROXIMITY 0x02
176 #define IDEV_HAS_PCKBD 0x04
180 char *nothing_for_now;
183 #define IDEV_KEYMAP_NAME_LEN 15
186 char name[IDEV_KEYMAP_NAME_LEN+1];
189 /* The valuator definition */
196 unsigned char possibleModes;
197 #define IDEV_ABSOLUTE 0x0
198 #define IDEV_RELATIVE 0x1
199 #define IDEV_EITHER 0x2
201 unsigned char mode; /* One of: IDEV_ABSOLUTE, IDEV_RELATIVE */
203 unsigned short resolution;
208 /* This is used to query a specific valuator with the IDEVGETVALUATORDESC ioctl */
211 unsigned short flags;
212 idevValuatorDesc desc;
215 #define IDEVGETDEVICEDESC _IOWR('i', 0, idevDesc)
216 #define IDEVGETVALUATORDESC _IOWR('i', 1, idevGetSetValDesc)
217 #define IDEVGETKEYMAPDESC _IOWR('i', 2, idevKeymapDesc)
218 #define IDEVINITDEVICE _IOW ('i', 51, unsigned int)
223 /* These are only interpreted by SHMIQ-attacheable devices and are internal
226 #define SHMIQ_OFF _IO('Q',1)
227 #define SHMIQ_ON _IO('Q',2)
229 void shmiq_push_event (struct shmqevent *e);
230 int get_sioc (struct strioctl *sioc, unsigned long arg);
233 #endif /* _ASM_SHMIQ_H */