YuuichiAkagawa/Arduino-AOA2

Do you look into AOA2.0 support 1.0 send value to android?

Opened this issue · 11 comments

Dear :
titile is my question.
I just look your code is acc.hidSendEvent(id, m, sizeof(m));

but the AOA1.0 acc.write fution can use?

thanks a lot

No. It can not be used at the same time.

Dear:
2.0 doesn't use app.
but I want to send value to andorid how can i do like AOA1.0

thanks

You can use in the same way.
e.g. Android's sample, Yaoadk samples.

I have question with acc.isConnectedHID and acc.isConnected();
I want to use app to receive data with acc.write(msg, 3);
and then I want to use HID mouse.
How can I conform?

thanks

so aoa1.0 and 2.0 can't be used at the same time?

How to prove it can't be used at the same time?

thanks

Following code is HelloADK + AOA2HID example.
https://gist.github.com/YuuichiAkagawa/ae5d28ce6fc108ff9bfe

HID & acc.read() is work. But acc.write() is not work.
My Android is Nexus 5@5.0.1 and Nexus 7@4.4.4.

Maybe conflict between HID and Accessory.
I don't know how to fix. This is android's problem.

Maybe problem is Data packet error: 5
I use serial monitor appear this error

Usb.cpp 111

//Serial.println( direction, HEX );
if( dataptr != NULL ) { //data stage, if present
rcode = ctrlData( addr, ep, nbytes, dataptr, direction );
}
if( rcode ) { //return error
Serial.print("Data packet error: ");
Serial.println( rcode, HEX );
return( rcode );
}
rcode = ctrlStatus( ep, direction ); //status stage
return( rcode );

I success once with https://gist.github.com/YuuichiAkagawa/ae5d28ce6fc108ff9bfe

and then failed

HID & acc.read() is work. acc.write() is work.

But problem is Data packet error: 5

This image is a captured USB packets.
usbpackets
"Control Transfer" is a HID event packet.
"OUT txn" is a acc.Write() packet.

Both packets are transferred. But Android App cannot receive "OUT txn" packet.

Again, I don't know how to fix.

It's amazing.
I try it sometime is ok. sometime is not ok.
This video is prove it is ok. http://goo.gl/ClEpDn
The problem maybe Usb.cpp line:148
rcode = outTransfer( addr, ep, nbytes, dataptr, nak_limit );
AndroidAccessory2.cpp line:303
int AndroidAccessory::write(void *buff, int len)
{
usb.outTransfer(1, out, len, (char *)buff);
return len;
}

Because sometime is ok the Serial Montor is appear Data packet error: 5 once.
When not ok is appear innumerable Data packet error: 5

error is from hidSendEvent fuction