Cambio en includes. Pinta idVendor e idProduct

This commit is contained in:
serxoz 2023-07-12 14:01:23 +02:00
parent 24e635da88
commit 687e76b5bb
2 changed files with 6 additions and 2 deletions

View File

@ -7,7 +7,7 @@ build: target/mpfm target/mpfm.service
target/mpfm: mpfm.c
mkdir -p target
$(CC) -std=gnu99 -O2 mpfm.c -I/usr/include/libusb-1.0 -lusb-1.0 -o target/mpfm
$(CC) -std=gnu99 -O2 mpfm.c -lusb-1.0 -o target/mpfm
target/mpfm.service: mpfm.service
mkdir -p target

6
mpfm.c
View File

@ -1,7 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <libusb.h>
#include <libusb-1.0/libusb.h>
static int count = 0;
@ -13,6 +13,10 @@ int hotplug_callback(struct libusb_context *ctx, struct libusb_device *dev,
printf("Entering callback\n"); // DEBUG
(void)libusb_get_device_descriptor(dev, &desc);
printf("%04x:%04x (bus %d, device %d)\n",
desc.idVendor, desc.idProduct,
libusb_get_bus_number(dev), libusb_get_device_address(dev));
if (LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED == event) {
rc = libusb_open(dev, &dev_handle);
if (LIBUSB_SUCCESS != rc) {