Cambio en includes. Pinta idVendor e idProduct
This commit is contained in:
parent
24e635da88
commit
687e76b5bb
2
Makefile
2
Makefile
@ -7,7 +7,7 @@ build: target/mpfm target/mpfm.service
|
|||||||
|
|
||||||
target/mpfm: mpfm.c
|
target/mpfm: mpfm.c
|
||||||
mkdir -p target
|
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
|
target/mpfm.service: mpfm.service
|
||||||
mkdir -p target
|
mkdir -p target
|
||||||
|
6
mpfm.c
6
mpfm.c
@ -1,7 +1,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <libusb.h>
|
#include <libusb-1.0/libusb.h>
|
||||||
|
|
||||||
static int count = 0;
|
static int count = 0;
|
||||||
|
|
||||||
@ -13,6 +13,10 @@ int hotplug_callback(struct libusb_context *ctx, struct libusb_device *dev,
|
|||||||
printf("Entering callback\n"); // DEBUG
|
printf("Entering callback\n"); // DEBUG
|
||||||
(void)libusb_get_device_descriptor(dev, &desc);
|
(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) {
|
if (LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED == event) {
|
||||||
rc = libusb_open(dev, &dev_handle);
|
rc = libusb_open(dev, &dev_handle);
|
||||||
if (LIBUSB_SUCCESS != rc) {
|
if (LIBUSB_SUCCESS != rc) {
|
||||||
|
Loading…
Reference in New Issue
Block a user