简体   繁体   中英

Android - Receiving Canon (Camera) events from USB

Using the Android USB framework I retrieve the relevant endpoints and use these to communicate with the tethered camera. I can connect and receive events from a Nikon camera, it sends event from the interrupt endpoint. However, when connecting to a Canon camera no data/event is received from this endpoint.

I read somewhere that Canon doesn't adhere to PTP, and sends events from the BULK IN endpoint, however, the camera is also not sending any data/events from this endpoint.

Example code currently being used;

byte[] data = new byte[4096];
int bytesRead = usbDeviceConnection.bulkTransfer(interruptEndpoint, data, data.length, 1000);
if(bytesRead > 0)
{
  // Read event
}

Any ideas how to read data from Canon? At the moment it seems as if the Camera isn't sending anything but I know it is.The exact Model is EOS 7D.

Managed to get this working after a lot of trial and error and USB sniffing.

The end points turned out to be the same although nothing seems to be sent over the interrupt endpoint - instead I am using the IN & OUT endpoints to request the events from the camera and then process the list of events returned.

Another issue seems to be that Canon has a custom PTP that it uses which can embed additional data inside USB packets.

Another difference was that for Nikon the EventCode I was looking for (ObjectAdded) was: 0x4002 and for Canon the EventCode was 0xC181

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM