-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Usage on other platforms. #1
Comments
I'm not familiar with Android development, how are you communicating with the USB? Something like libusb? You could sniff the traffic of gphoto2 using Wireshark and see if there are any additional packets you need to send to the device which might be missing from the code in this repo due to being handled by the WIA API. |
I use the default Usb implementation for Android (https://developer.android.com/guide/topics/connectivity/usb/host) where i can select the out endpoint (bulk and out). |
https://github.com/michaelzoech/remoteyourcam-usb this looks like a great starting point, it has handlers for Canon / Nikon cameras, the protocols should be the same for the Sony cameras. https://github.com/michaelzoech/remoteyourcam-usb/blob/master/src/com/remoteyourcam/usb/ptp/PtpConstants.java here are the opcodes for the Canon / Nikon cameras. The opcodes around 0x1000 are common among all cameras using PTP so that would probably be a good place to start to ensure you're successfully communicating with the camera. Once you have something working you can then move onto the vendor specific opcodes which are used to control the functions of the camera https://github.com/pixeltris/SonyAlphaUSB/blob/master/SonyAlphaUSB/Ids.cs |
I needed some time to build this and to dig into the code but it's working! Thank you very much, saved my month probably. |
Connection works now, i've seen that you don't use the capture code aroung 0x1000 (so you don't use 0x100E), i tested this one - doesn't work. What you actually do is using 2 opcodes, one for the type of the settings, you name it |
Yea I don't think the sony alpha cameras respond to the regular type of image capture, instead there are operations for pressing/releasing the shutter (in the same way that you would take a picture manually). This repo currently doesn't have a proper handlers for this (I will get around to doing this eventually). ghoto2 has an implementation And yea sorry my naming conventions probably aren't correct for |
What i know from the wireless implementation of the Sony APi is, that only A7iii and A9 etc need to have a half press (and only if there is no timer, so if you set the timer to 2 sec and mf then you don't need to call the half press first) and for (my) a6300 you don't need half press at all (i tried it with your code too). |
If things don't seem to quite match up I'd suggest logging what the Imaging Edge software does with Wireshark and just copy that. It's likely that the WIA API does some additional stuff behind the scenes and possibly byte order changes which is why things might look a little different. From what I can tell though gphoto2 uses the same image capture logic for a6300 as it does a7iii (you could always set up gphoto2 and confirm this). |
I got it, it was not that the packet was wrong but WIA sends another packet after your shoot comand, that looks just a little bit different (without the 0xc2d2 part and with a 2 instead of a 1). I'm able to capture images with my phone! - But did you every notice that you're |
Great! I think if it's in MF it will always take the picture, but AF it has to actually gain focus before it will take the picture. This is something I haven't handled properly yet but the gphoto2 implementation that I linked before handles it and should capture the image 100% of the time. Roughly copying what they do should fix that issue. |
What i have red so far it's only possible to store the images on the camera on A7iii (and maybe A9), all other cameras only will send the image via usb when it's requested but not store it actually.
|
Yea I noticed that, it's a little unfortunate. Maybe if something in PTP supports transferring images to the camera you could make a hacky workaround. |
There must be another option because the Sony RM-SPR1 (https://www.sony.de/electronics/kameras-mit-wechselobjektiv-stative-fernbedienungen/rm-spr1) can trigger the capture and it will be saved onto the camera. |
Interesting, I assume that's done on a different protocol or something? There seem to be a couple of third party products which do the same thing. Maybe someone has documented it somewhere? I assume you'd need some micro usb MITM device to sniff the packets if not. |
Looks like there are some special sony pins according to https://www.dpreview.com/forums/thread/3551161 |
Hi nailik, did you manage to control your sony camera on android ? |
Yes i managed it, i can call the shutter - not more yet. I'm currently working on a flutter plugin for usb (which also works). At the moment i try to get it working on Windows too but i have problems with libusb. |
Hey @pixeltris I'm still working on this and I wonder if you could help me. |
The official software uses WIA so I hooked the WIA function IWiaItemExtras::Escape as can be seen here and wrote my own crappy logging for that (so that I could log camera values and stuff). I didn't try going down the wireshark route so I'm not sure how the data should look at a raw USB protocol level so I'm not much help there unfortunately! |
Ahh I see, you wrote "I just implemented what I observed when logging calls from Sony imaging edge software" (Some comments above), how did you look the calls without wireshark? |
As I mentioned I hooked the WIA function IWiaItemExtras::Escape which is the function used by the official software to transfer data between the camera. It is therefore possible to log the data before it even hits driver / wireshark level, or even modify data if desired. If you're not too sure what I mean by function hooking you can read this Wikipedia page which gives an overview of how it works https://en.wikipedia.org/wiki/Hooking If you want to know exactly how the hooking works in this specific case: Program.cs will call You can use an API monitor (http://www.rohitab.com/apimonitor) if you want to log the IWiaItemExtras::Escape function without using my convoluted hooking mechanism, but you'd need to grab the xml definitions from here. I didn't find this way of monitoring too useful as it isn't easy to filter the data you actually want, and data is constantly communicated between the camera. That's why I wrote my own logger. |
Thank you for your nice explanation! I missunderstood "hooking" and i see why you use your own mechanism, because the liveview can't be turned off. |
Hi there, i'm still working on this and i found some issues and would like you to recheck it.
The thing is that metering mode gives me I just try to figure some "Unknown" stuff out. |
I think 0x80 values are just vendor specific values as noted in gphoto2. For standardized values 0x80 isn't used which is why some values have 0x80 and some don't. See the metering mode values used by this project / gphoto2 SonyAlphaUSB/SonyAlphaUSB/Ids.cs Line 702 in 4361b3e
|
Well jeah, your MeteringMode Ids do not work on my a6300.
|
I'm not following what you're saying honestly. gphoto2 uses the same values as I do which are generically flagged as "SONY" (gphoto2 supports many sony cameras). So the values definitely should be correct. EDIT: Oh I see what you're saying, the camera is stating a metering mode value which isn't even in the list of 'available values'. Not too sure what's going on there. I don't have my camera at the moment to test how it behaves on my machine. It might be a bug in the firmware? Are any other values miss-matched? Is there any difference for |
Both is working, camera doesn't make a difference if i send |
That's weird, are there any other settings which have this behavior? You could possibly remap values which are reported incorrectly by checking if there's a mismatch between the available list and what's sent, then automatically append 0x8000 internally so that it at least maps up correctly on your side (assuming there's an equivilant matching 0x8000 e.g. 0x0002->0x8002). |
Everything else - seems to work but i didn't test everything, currently it's more testing if it works well enough to make it a project. Is there a way to contact you instead of commenting on this issue? |
I don't currently have my camera around to test things, I might do in a month or so. |
Hi,
i really like the work you did here. I'm trying to use this on Android but my current Problem is, that i don't really now how
IWiaItemExtras::Escape method
works and what it exaclty sends. (My attemps so far had no affect on the camera).I would be happy if you can help me out!
The text was updated successfully, but these errors were encountered: