blob: f604dd97a92cf67630d8663c2762c09c121005bb (
plain) (
tree)
|
|
/* See LICENSE file for copyright and license details. */
#include "libgamepad.h"
#include <stdio.h>
#include <stdlib.h>
int
main(void)
{
char **devices;
size_t ndevices, i, j;
struct libgamepad_superdevice device;
if (libgamepad_list_superdevices(&devices, &ndevices)) {
perror("libgamepad_list_superdevices");
return 1;
}
for (i = 0; i < ndevices; i++) {
if (libgamepad_open_superdevice(&device, devices[i])) {
perror("libgamepad_open_superdevice");
free(devices[i]);
continue;
}
free(devices[i]);
printf("%s\n", device.syspath);
for (j = 0; j < device.ndevices; j++)
printf("\t%s (%x)\n", device.devices[j]->path, device.devices[j]->type);
for (j = 0; j < device.nleds; j++)
printf("\t%s (LED)\n", device.leds[j]);
for (j = 0; j < device.npower_supplies; j++)
printf("\t%s (PSU)\n", device.power_supplies[j]);
libgamepad_close_superdevice(&device);
}
free(devices);
return 0;
}
|