nusb/lib: provide a setalt() function to set the interface to its altsetting
This commit is contained in:
parent
9cd55a085d
commit
bea20cd152
2 changed files with 11 additions and 0 deletions
|
@ -482,6 +482,16 @@ unstall(Dev *dev, Dev *ep, int dir)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
setalt(Dev *d, Iface *ifc)
|
||||||
|
{
|
||||||
|
if(usbcmd(d, Rh2d|Rstd|Riface, Rsetiface, ifc->alt, ifc->id, nil, 0) < 0){
|
||||||
|
werrstr("setalt: %s: %r", d->dir);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* To be sure it uses a single write.
|
* To be sure it uses a single write.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -353,5 +353,6 @@ int parsedev(Dev *xd, uchar *b, int n);
|
||||||
int unstall(Dev *dev, Dev *ep, int dir);
|
int unstall(Dev *dev, Dev *ep, int dir);
|
||||||
int usbcmd(Dev *d, int type, int req, int value, int index, uchar *data, int count);
|
int usbcmd(Dev *d, int type, int req, int value, int index, uchar *data, int count);
|
||||||
Dev* getdev(char *devid);
|
Dev* getdev(char *devid);
|
||||||
|
int setalt(Dev *d, Iface *ifc);
|
||||||
|
|
||||||
extern int usbdebug; /* more messages for bigger values */
|
extern int usbdebug; /* more messages for bigger values */
|
||||||
|
|
Loading…
Reference in a new issue