Skip to content

Instantly share code, notes, and snippets.

@masui
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masui/36037cb1e5003eaf89c0 to your computer and use it in GitHub Desktop.
Save masui/36037cb1e5003eaf89c0 to your computer and use it in GitHub Desktop.
Raspberry PiのRubyでマウスホイール信号を取得する
File.open("/dev/input/event0","rb"){ |f|
while true do
s = f.read 16
(time, type, code, value) = s.unpack "qssi"
if type == 2 and code == 8 then
puts value
end
end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment