Skip to content

Instantly share code, notes, and snippets.

@also
Created August 31, 2012 00:49
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 also/3546825 to your computer and use it in GitHub Desktop.
Save also/3546825 to your computer and use it in GitHub Desktop.
Control Onkyo Receivers via ISCP
require 'socket'
s = TCPSocket.new ARGV[0], 60128
def hexify_command(cmd)
cmd = '!1' + cmd unless cmd.start_with? '!1'
"ISCP\x00\x00\x00\x10\x00\x00\x00#{(cmd.length + 1).chr}\x01\x00\x00\x00#{cmd}\x0D"
end
s.write hexify_command(ARGV[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment