Skip to content
Georg Lukas edited this page Oct 11, 2023 · 1 revision

Reading Keypresses

Internally, the camera has two keyboards:

  • keyboard0 - Covers the buttons on top of the camera.
  • keyboard1 - Covers the buttons on the back of the camera.

Note that buttons on the lens are handled by the lens itself, and are not processed by the camera body. The mode wheel seems to be handled separately somehow too.

Key events can be watched using the command: xinput test keyboard<#>

Keycodes, Keyboard0

  • ??? On
  • 124 Off
  • 133 Shutter Half-Press
  • 134 Shutter Full-Press
  • 186 Zoom Out
  • 185 Zoom In
  • 223 Direct Link
  • 220 Video Record

Keycodes, Keyboard1

  • 181 +/-
  • 135 Menu
  • 180 Fn
  • 083 Left
  • 085 Right
  • 080 Up
  • 088 Down
  • 104 OK
  • 179 Play
  • 091 Trash

Injecting Keypresses

The camera has a built-in tool for pressing keys. This can be used by scripts for automation.

Usage:

st key [push/release/click] [command] 

where [command] is:

  • up
  • left
  • right
  • down
  • del
  • ok
  • pwoff
  • pwon
  • reset - don't use this, there's a "reset" command which does the same thing.
  • s1 - Shutter half-press.
  • s2 - Shutter full-press.
  • menu
  • pb - Play Button.
  • fn
  • ev - The +/- button.
  • rec - Video record button.
  • wifi - The Direct Link button.
  • end - Not sure.

Note: To automate the shutter, make sure to "push s1", "click s2", "release s1".

st key jog [command] 

where [command] is:

  • cw - clockwise turn
  • ccw - counter-clockwise turn

st key mode [command]

This is intended to set the mode dial. However, changing the mode doesn't seem to work.

Injecting Touchscreen Events

st key touch [push/release/click] [x] [y]

This automated touchscreen events. Note that the screen is sideways, such that x0,y0 is on the bottom left. Screen size is 480x800 pixels, as can be determined by running xdpyinfo | grep 'dimensions:'

For example, this will click the typical "Back" button that appears in bottom left:

st key touch click 5 5

Click in bottom right

st key touch click 5 795