diff options
Diffstat (limited to 'include/mtdev.h')
| -rw-r--r-- | include/mtdev.h | 99 |
1 files changed, 15 insertions, 84 deletions
diff --git a/include/mtdev.h b/include/mtdev.h index 98e022a..b759803 100644 --- a/include/mtdev.h +++ b/include/mtdev.h | |||
| @@ -109,28 +109,6 @@ struct mtdev { | |||
| 109 | }; | 109 | }; |
| 110 | 110 | ||
| 111 | /** | 111 | /** |
| 112 | * mtdev_init - initialize mtdev converter | ||
| 113 | * @dev: the mtdev to initialize | ||
| 114 | * | ||
| 115 | * Sets up the internal data structures. | ||
| 116 | * | ||
| 117 | * Returns zero on success, negative error number otherwise. | ||
| 118 | */ | ||
| 119 | int mtdev_init(struct mtdev *dev); | ||
| 120 | |||
| 121 | /** | ||
| 122 | * mtdev_configure - configure the mtdev converter | ||
| 123 | * @dev: the mtdev to configure | ||
| 124 | * @fd: file descriptor of the kernel device | ||
| 125 | * | ||
| 126 | * Reads the device properties to set up the protocol capabilities. | ||
| 127 | * If preferred, this can be done by hand, omitting this call. | ||
| 128 | * | ||
| 129 | * Returns zero on success, negative error number otherwise. | ||
| 130 | */ | ||
| 131 | int mtdev_configure(struct mtdev *dev, int fd); | ||
| 132 | |||
| 133 | /** | ||
| 134 | * mtdev_open - open an mtdev converter | 112 | * mtdev_open - open an mtdev converter |
| 135 | * @dev: the mtdev to open | 113 | * @dev: the mtdev to open |
| 136 | * @fd: file descriptor of the kernel device | 114 | * @fd: file descriptor of the kernel device |
| @@ -140,8 +118,8 @@ int mtdev_configure(struct mtdev *dev, int fd); | |||
| 140 | * | 118 | * |
| 141 | * Returns zero on success, negative error number otherwise. | 119 | * Returns zero on success, negative error number otherwise. |
| 142 | * | 120 | * |
| 143 | * This call combines mtdev_init() and mtdev_configure(), which | 121 | * This call combines the plumbing functions mtdev_init() and |
| 144 | * may be used separately instead. | 122 | * mtdev_configure(). |
| 145 | */ | 123 | */ |
| 146 | int mtdev_open(struct mtdev *dev, int fd); | 124 | int mtdev_open(struct mtdev *dev, int fd); |
| 147 | 125 | ||
| @@ -157,73 +135,26 @@ int mtdev_open(struct mtdev *dev, int fd); | |||
| 157 | int mtdev_idle(struct mtdev *dev, int fd, int ms); | 135 | int mtdev_idle(struct mtdev *dev, int fd, int ms); |
| 158 | 136 | ||
| 159 | /** | 137 | /** |
| 160 | * mtdev_fetch - fetch an event from the kernel device | 138 | * mtdev_get - get processed events from mtdev |
| 161 | * @dev: the mtdev in use | ||
| 162 | * @fd: file descriptor of the kernel device | ||
| 163 | * @ev: the kernel input event to fill | ||
| 164 | * | ||
| 165 | * Fetch a kernel event from the kernel device. The read operation | ||
| 166 | * behaves as dictated by the file descriptor; if O_NONBLOCK is not | ||
| 167 | * set, the read will block until an event is available. | ||
| 168 | * | ||
| 169 | * On success, returns the number of events read. Otherwise, a standard | ||
| 170 | * negative error number is returned. | ||
| 171 | */ | ||
| 172 | int mtdev_fetch(struct mtdev *dev, int fd, struct input_event *ev); | ||
| 173 | |||
| 174 | /** | ||
| 175 | * mtdev_put - put an event into the converter | ||
| 176 | * @dev: the mtdev in use | ||
| 177 | * @ev: the kernel input event to put | ||
| 178 | * | ||
| 179 | * Put a kernel event into the mtdev converter. The event should | ||
| 180 | * come straight from the device. | ||
| 181 | * | ||
| 182 | * This call does not block; if the buffer becomes full, older events | ||
| 183 | * are dropped. The buffer is guaranteed to handle several complete MT | ||
| 184 | * packets. | ||
| 185 | */ | ||
| 186 | void mtdev_put(struct mtdev *dev, const struct input_event *ev); | ||
| 187 | |||
| 188 | /** | ||
| 189 | * mtdev_pull - pull events from the kernel device | ||
| 190 | * @dev: the mtdev in use | 139 | * @dev: the mtdev in use |
| 191 | * @fd: file descriptor of the kernel device | 140 | * @fd: file descriptor of the kernel device |
| 192 | * @max_events: max number of events to read (zero for all) | 141 | * @ev: array of input events to fill |
| 193 | * | 142 | * @ev_max: maximum number of events to read |
| 194 | * Read a maxmimum of max_events events from the device, and put them | ||
| 195 | * in the converter. If max_events is zero, all available events will | ||
| 196 | * be read. The read operation behaves as dictated by the file | ||
| 197 | * descriptor; if O_NONBLOCK is not set, the read will block until | ||
| 198 | * max_events events are available or the buffer is full. | ||
| 199 | * | 143 | * |
| 200 | * On success, returns the number of events read. Otherwise, a standard | 144 | * Get a processed event from mtdev. The events appear as if they came |
| 201 | * negative error number is returned. | 145 | * from a type B device emitting MT slot events. |
| 202 | * | ||
| 203 | * This call combines mtdev_fetch() with mtdev_put(), which | ||
| 204 | * may be used separately instead. | ||
| 205 | */ | ||
| 206 | int mtdev_pull(struct mtdev *dev, int fd, int max_events); | ||
| 207 | |||
| 208 | /** | ||
| 209 | * mtdev_empty - check if there are events to get | ||
| 210 | * @dev: the mtdev in use | ||
| 211 | * | 146 | * |
| 212 | * Returns true if the event queue is empty, false otherwise. | 147 | * The read operations involved behave as dictated by the file |
| 213 | */ | 148 | * descriptor; if O_NONBLOCK is not set, mtdev_get() will block until |
| 214 | int mtdev_empty(struct mtdev *dev); | 149 | * the specified number of processed events are available. |
| 215 | |||
| 216 | /** | ||
| 217 | * mtdev_get - get canonical events from mtdev | ||
| 218 | * @dev: the mtdev in use | ||
| 219 | * @ev: the input event to fill | ||
| 220 | * | 150 | * |
| 221 | * Get a canonical event from mtdev. The events appear as if they came | 151 | * On success, returns the number of events read. Otherwise, |
| 222 | * from a type B device emitting MT slot events. | 152 | * a standard negative error number is returned. |
| 223 | * | 153 | * |
| 224 | * The queue must be non-empty before calling this function. | 154 | * This call combines the plumbing functions mtdev_fetch_event(), |
| 155 | * mtdev_put_event() and mtdev_get_event(). | ||
| 225 | */ | 156 | */ |
| 226 | void mtdev_get(struct mtdev *dev, struct input_event* ev); | 157 | int mtdev_get(struct mtdev *dev, int fd, struct input_event* ev, int ev_max); |
| 227 | 158 | ||
| 228 | /** | 159 | /** |
| 229 | * mtdev_close - close the mtdev converter | 160 | * mtdev_close - close the mtdev converter |
