YuuichiAkagawa / Arduino-AOA2

Android AOA2.0(ADK2) for Arduino
13 stars 5 forks source link

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

Open lowfiend opened 9 years ago

lowfiend commented 9 years ago

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

YuuichiAkagawa commented 9 years ago

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

lowfiend commented 9 years ago

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

thanks

YuuichiAkagawa commented 9 years ago

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

lowfiend commented 9 years ago

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

YuuichiAkagawa commented 9 years ago

No.

lowfiend commented 9 years ago

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

YuuichiAkagawa commented 9 years ago

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.

lowfiend commented 9 years ago

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 );

lowfiend commented 9 years ago

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

YuuichiAkagawa commented 9 years ago

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.

lowfiend commented 9 years ago

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