#! /usr/bin/ruby # Copyright (C) 2006,2007 John Anderson # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. require 'controls.rb' require 'mackie.rb' while !File.exist? ARGV[0] sleep 0.010 end #mapping_csv = ARGV[1] || "mackie-controls.csv" mapping_csv = ARGV[1] puts "mapping_csv: #{mapping_csv}" puts "" file = File.open ARGV[0], 'r+' mck = Mackie.new( file ) # send device query response = mck.sysex( "\x00" ) puts "response: #{response.to_hex}" # decode host connection query status = response[0] if status != 1 puts "expected 01, got " + response.to_hex.inspect exit(1) end serial = response[1..7] challenge = response[8..11] puts <