Commit 72cd0d896c7c73c5379a869f9f52e74bd48ac17e

Authored by achemin1
1 parent 6bd47a15

(Ré)Ajout 4.1 bonus

include/libusb_wrapper.h
... ... @@ -4,6 +4,7 @@
4 4 #include <libusb-1.0/libusb.h>
5 5 #include <stdlib.h>
6 6 #include <stdio.h>
  7 +#include <stdbool.h>
7 8  
8 9 void usbinit(libusb_context** context_ptr);
9 10  
... ... @@ -12,6 +13,7 @@ void usbclose(libusb_context* context);
12 13 ssize_t getListDevices(libusb_context* context, libusb_device***list_ptr);
13 14  
14 15 void displayDevices(libusb_context *context);
  16 +void displayDevicesMore(libusb_context *context);
15 17  
16 18 void displayDeviceEndpoints ();
17 19  
... ...
src/libusb_wrapper.c
1 1 #include "libusb_wrapper.h"
2 2  
3 3  
  4 +
4 5 void usbinit(libusb_context **context_ptr) {
5 6 //libusb_context *context;
6 7 int statusInit = libusb_init(context_ptr);
... ... @@ -95,7 +96,6 @@ void _displayOneDevice(libusb_device *device){
95 96 printf("Vendor ID 0x0%x\n", desc.idVendor);
96 97 printf("Product ID 0x0%x\n", desc.idProduct);
97 98  
98   - //_printConfig(device); //Does it work ?
99 99 //displayDeviceEndpoints(device); //Not really work on Axel@Alptop
100 100 }
101 101  
... ... @@ -103,6 +103,16 @@ void displayDevices(libusb_context *context) {
103 103 _enumerateDevices(context, _displayOneDevice);
104 104 }
105 105  
  106 +void _displayOneDeviceMore(libusb_device *device){
  107 + _displayOneDevice(device);
  108 + _printConfig(device);
  109 +}
  110 +
  111 +void displayDevicesMore(libusb_context *context) {
  112 + _enumerateDevices(context, _displayOneDeviceMore);
  113 +}
  114 +
  115 +
106 116 //void getFirstDeviceFromID(vid, pid)
107 117  
108 118  
... ...
src/main.c
... ... @@ -14,6 +14,10 @@ int main(int argc, char *argv[]){
14 14 printf("\e[91mDemo 4.1\e[39m\n");
15 15 displayDevices(context);
16 16 }
  17 + else if(strcmp(argv[1], "demo4.1plus") == 0) { //if 4.1 bonus
  18 + printf("\e[91mDemo 4.1\e[39m\n");
  19 + displayDevicesMore(context);
  20 + }
17 21 else if(strcmp(argv[1], "demo4.2") == 0){//if 4.2
18 22 printf("\e[91mDemo 4.2\e[39m\n");
19 23  
... ...