USBHOST : change interrupt endpoint behaviour

In case interrupt reports error,
call back  can send interrupt request again.
pull/4231/head
Michel Jaouen 2017-04-21 08:47:57 +02:00
parent fa2abd22c7
commit ccce1c5273
3 changed files with 36 additions and 26 deletions

View File

@ -264,6 +264,12 @@ void USBHost::usb_process()
if (deviceInUse[idx]) {
USB_WARN("td %p processed but not in idle state: %s [ep: %p - dev: %p - %s]", usb_msg->td_addr, ep->getStateString(), ep, ep->dev, ep->dev->getName(ep->getIntfNb()));
ep->setState(USB_TYPE_IDLE);
/* as error, on interrupt endpoint can be
* reported, call the call back registered ,
* if device still in use, this call back
* shall ask again an interrupt request.
*/
ep->call();
}
}
}

View File

@ -102,33 +102,37 @@ bool USBHostMouse::connect()
void USBHostMouse::rxHandler()
{
int len_listen = int_in->getSize();
int len_listen = int_in->getLengthTransferred();
if (len_listen !=0) {
if (onUpdate) {
(*onUpdate)(report[0] & 0x07, report[1], report[2], report[3]);
if (onUpdate) {
(*onUpdate)(report[0] & 0x07, report[1], report[2], report[3]);
}
if (onButtonUpdate && (buttons != (report[0] & 0x07))) {
(*onButtonUpdate)(report[0] & 0x07);
}
if (onXUpdate && (x != report[1])) {
(*onXUpdate)(report[1]);
}
if (onYUpdate && (y != report[2])) {
(*onYUpdate)(report[2]);
}
if (onZUpdate && (z != report[3])) {
(*onZUpdate)(report[3]);
}
// update mouse state
buttons = report[0] & 0x07;
x = report[1];
y = report[2];
z = report[3];
}
if (onButtonUpdate && (buttons != (report[0] & 0x07))) {
(*onButtonUpdate)(report[0] & 0x07);
}
if (onXUpdate && (x != report[1])) {
(*onXUpdate)(report[1]);
}
if (onYUpdate && (y != report[2])) {
(*onYUpdate)(report[2]);
}
if (onZUpdate && (z != report[3])) {
(*onZUpdate)(report[3]);
}
// update mouse state
buttons = report[0] & 0x07;
x = report[1];
y = report[2];
z = report[3];
/* set again the maximum value */
len_listen = int_in->getSize();
if (len_listen > sizeof(report)) {
len_listen = sizeof(report);

View File

@ -188,7 +188,7 @@ void USBHostHub::rxHandler()
{
uint32_t status;
if (int_in) {
if (int_in->getState() == USB_TYPE_IDLE) {
if ((int_in->getLengthTransferred())&&(int_in->getState() == USB_TYPE_IDLE)) {
for (int port = 1; port <= nb_port; port++) {
status = getPortStatus(port);
USB_DBG("[hub handler hub: %d] status port %d [hub: %p]: 0x%X", dev->getHub(), port, dev, status);