Can PC read button press/dial turn info from camera?

Started by Nikoheart, December 27, 2022, 04:33:10 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Nikoheart

Hey there!
I'd like to pose an interesting concept I'd like to do, but need to know if something like this is potentially achievable and some advice on where I can start.

Is it possible with Magic Lantern, maybe with a LUA script or something, that I could get my Canon 5D MK III (old camera I hardly use anymore, but now could use for this meme) to essentially turn my camera into a game controller?

Concept: put the camera into a 'demo' mode per se, which would be just a simple screen for basically allowing inputs to happen, and any input like camera shutter press, dial turn, u/d/l/r arrows, maybe even lens zoom, etc. could send data over USB to my Windows PC for it to read what input is being pressed?

All I'd need to do is potentially use something like FreePIE to convert the incoming info into designated KBM/Mouse assignments

Most articles I read are about software/library's controlling the camera but I'm essentially looking at the reverse

Looking forward to hearing from the collective minds of Magic Lantern and thanks for reading

theBilalFakhouri

Hi!
I think getting buttons presses could be done somehow via PTP?

@petabyte might know something about it

petabyte

You could do it by creating a custom PTP command that reports keypresses. You could do it in a module, like I did recently: https://github.com/petabyt/ptpview/blob/master/ptpview.c
For receiving the data, you could use Python ptpy and https://github.com/fujihack/fujihack/blob/master/ptp/hijack.py to run custom opcodes.

names_are_hard

Am I right in thinking you have to poll with PTP?  If so latency might be a factor for use as a controller.

UART is simpler to code and doesn't require polling, but does require minor messing about to connect up (details already given on Discord).

petabyte

Yep, you would have to poll. It's fast enough for grabbing things like ISO and shutter speed from the camera. No idea on how slow it would feel as a controller. I'd say it should be possible to poll maybe 200 per second from the camera, maybe more.

dpjpandone

Quote from: Nikoheart on December 27, 2022, 04:33:10 PM


Is it possible with Magic Lantern, maybe with a LUA script or something, that I could get my Canon 5D MK III (old camera I hardly use anymore, but now could use for this meme) to essentially turn my camera into a game controller?




this would be a cool proof of concept project and if the use case was for controlling some type of tethered shooting software it has potential to be useful, but using an expensive camera for a video game controller seems like unneccesary wear and tear on mechanical components with a finite service life

you say "meme" are you doing this as a joke? If this is for a skit just fake it in post, film closeup of fingers on buttons and cut to reaction on screen, but if you are serious about conveting the 5d3 you hardly use to a video game controller, just sell it to me for the price of the top of the line video game controller!

petabyte

There was somebody on Youtube who beat Minecraft with a steering wheel, I'd say the next logical step should be beating Minecraft with a DSLR.