Files
libratbag/uLogitech/src/list_unifying_devices.c
Peter Hutterer 93ca4e24d4 Relicense the uLogitech bits to MIT
With permission from Benjamin Tissoires and Olivier Gay

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-20 14:59:46 +10:00

60 lines
1.8 KiB
C

/*
* List unifying devices attached to a receiver.
*
* Copyright 2013 Benjamin Tissoires <benjamin.tissoires@gmail.com>
* Copyright 2013 Red Hat, Inc
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
/*
* Based on the HID++ 1.0 documentation provided by Nestor Lopez Casado at:
* https://drive.google.com/folderview?id=0BxbRzx7vEV7eWmgwazJ3NUFfQ28&usp=sharing
*/
#include <linux/types.h>
#include <stdio.h>
#include <unistd.h>
#include <unifying.h>
#include <hidpp10.h>
int main(int argc, char **argv)
{
int fd;
/* Open the Unifying Receiver. */
if (argc == 1)
fd = unifying_find_receiver();
else {
fd = unifying_open_receiver(argv[1]);
if (fd < 0)
perror("Unable to open device");
}
if (fd < 0)
return 1;
hidpp10_list_devices(fd);
close(fd);
return 0;
}