Author Topic: Blinking debug messages at startup  (Read 3475 times)

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 10345
  • 5D Mark Free
Blinking debug messages at startup
« on: August 21, 2014, 01:43:23 PM »
Here's a tool that might be useful for troubleshooting dead cameras. It blinks all Canon debug messages via card LED, and you can point another camera at that LED to decode them.

Blinker source: blink.c
Decoder source: deblink.c
Decoder binary: deblink.mo

Usage:

For the inspected camera:
- compile the dm-spy-experiments branch with CONFIG_DEBUG_INTERCEPT_STARTUP_BLINK=y in Makefile.user, and (optional) define PRINT_EACH_MESSAGE in dm-spy.c
- you may want to tweak the message format to reduce verbosity (LED blink communication is not very fast)
- load the autoexec, and it should start blinking
- first 5 blinks are for synchronization, and to give you some time to position the other camera towards its LED

For the camera used to decode the blinks:
- load the deblink module
- switch it to movie mode, 60fps, looking at the LED of the other one, as in the screenshot
- you should see the LED in the center of the screen; defocus your lens so you can see it bigger
- start the decoder from Debug -> Decode LED blinks
- expose so you can see the LED clearly when it's on, and nearly black when it's off
- make sure the good camera's LED blinks in the same way as the bad one's (if not, adjust exposure until it does)

How it works:
- it simply encodes 0 as a short blink and 1 as a long blink
- each byte is sent with LSB first
- at startup, it sends 0xA5 5 times, with some delay, for synchronization
- from these sync bytes, the decoder attempts to autodetect the threshold for long/short blinks
- no further sync attempts or error checks are done

Caveats:
- the protocol is neither very fast, nor very robust (once it loses sync, it can't recover and you should restart)
- to restart the de-blinker, you need to restart both cameras



If the messages are not detailed enough, add custom hooks in dm-spy-extra.c (more info here).