1
/*****************************************************************************
3
* evemu - Kernel device emulation
5
* Copyright (C) 2010, 2011 Canonical Ltd.
7
* This program is free software: you can redistribute it and/or modify it
8
* under the terms of the GNU General Public License as published by the
9
* Free Software Foundation, either version 3 of the License, or (at your
10
* option) any later version.
12
* This program is distributed in the hope that it will be useful, but
13
* WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* General Public License for more details.
17
* You should have received a copy of the GNU General Public License along
18
* with this program. If not, see <http://www.gnu.org/licenses/>.
20
* Copyright (C) 2010 Henrik Rydberg <rydberg@euromail.se>
22
* Permission is hereby granted, free of charge, to any person obtaining a
23
* copy of this software and associated documentation files (the "Software"),
24
* to deal in the Software without restriction, including without limitation
25
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
26
* and/or sell copies of the Software, and to permit persons to whom the
27
* Software is furnished to do so, subject to the following conditions:
29
* The above copyright notice and this permission notice (including the next
30
* paragraph) shall be included in all copies or substantial portions of the
33
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
34
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
35
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
36
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
37
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
38
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
39
* DEALINGS IN THE SOFTWARE.
41
****************************************************************************/
49
static int describe_device(int fd)
51
struct evemu_device *dev;
57
ret = evemu_extract(dev, fd);
61
evemu_write(dev, stdout);
67
int main(int argc, char *argv[])
71
fprintf(stderr, "Usage: %s <device>\n", argv[0]);
74
fd = open(argv[1], O_RDONLY);
76
fprintf(stderr, "error: could not open device\n");
79
if (describe_device(fd)) {
80
fprintf(stderr, "error: could not describe device\n");