-
fonctions déconseillées ;
- tube de contrôle :
int typ=LIBUSB_REQUEST_TYPE_xxx; /* see libusb.h */
int req=LIBUSB_REQUEST_yyy ; /* see libusb.h */
int val=...; /* parameter for req */
int ind=...; /* parameter for req */
char data[MAX_DATA]; /* data to send or to receive */
int size=...; /* size to send or maximum size to receive */
int timeout=...; /* timeout in ms */
int nb_bytes=libusb_control_transfer(handle,typ,req,val,ind,data,size,timeout);
- tube pour interruptions :
int endpoint_out=...; /* ID of endpoint (bit 8 is 0) */
int endpoint_in=...; /* ID of endpoint (bit 8 is 1) */
char data[MAX_DATA]; /* data to send or to receive */
int size=...; /* size to send or maximum size to receive */
int timeout=...; /* timeout in ms */
/* OUT interrupt, from host to device */
int bytes_out;
int status=libusb_interrupt_transfer(handle,endpoint_out,data,size,&bytes_out,timeout);
if(status!=0){ perror("libusb_interrupt_transfer"); exit(-1); }
/* IN interrupt, host polling device */
int bytes_in;
int status=libusb_interrupt_transfer(handle,endpoint_in,data,size,&bytes_in,timeout);
if(status!=0){ perror("libusb_interrupt_transfer"); exit(-1); }
- tube pour transfert de volume :
int endpoint_out=...; /* ID of endpoint (bit 8 is 0) */
int endpoint_in=...; /* ID of endpoint (bit 8 is 1) */
char data[MAX_DATA]; /* data to send or to receive */
int size=...; /* size to send or maximum size to receive */
int timeout=...; /* timeout in ms */
/* OUT bulk transfer */
int bytes_out;
int status=libusb_bulk_transfer(handle,endpoint_out,data,size,&bytes_out,timeout);
if(status!=0){ perror("libusb_bulk_transfer"); exit(-1); }
/* IN bulk transfer */
int bytes_in;
int status=libusb_bulk_transfer(handle,endpoint_in,data,size,&bytes_in,timeout);
if(status!=0){ perror("libusb_bulk_transfer"); exit(-1); }