Created
November 12, 2014 15:42
-
-
Save takaswie/b7409ce0a45daf72b939 to your computer and use it in GitHub Desktop.
VENDOR-DEPENDENT commands for Terratec PHASE 88 FW Rack (and EWS MIC2/MIC8, too)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Advanced Standalone Mode for | |
# EWS MIC 2/8 (96kHz or ADAT Firmware since Version 1.13.13.31) and | |
# PHASE 88 Rack FW (since Firmware Version 1.17.13.31) | |
# ftp://ftp.terratec.de/Producer/PHASE/PHASE88RACKFireWire/Manual/PHASE88Rack_FW_AdvancedStandaloneMode_Tutorial.pdf | |
# | |
# | |
# Document number 2004006 | |
# AV/C Digital Interface Command Set General Specification Version 4.2 | |
# September 1, 2004 | |
# | |
# | |
# 9.6 VENDOR-DEPENDENT commands | |
# 9.6.1 VENDOR-DEPENDENT commands | |
# | |
# The VENDOR-DEPENDENT command permits module vendors to specify their own | |
# set of commands and responses for AV/C units or subunits determined by | |
# the AV/C address that is contained in the AV/C frame. The format of | |
# VENDOR-DEPENDENT command frame is shown below. | |
# | |
# | |
# length ck msb <-> lsb | |
# opcode 1 * VENDOR-DEPENDENT (0x00) | |
# operand[0] 3 * company ID (most significant byte) | |
# operand[1] company ID | |
# operand[2] company ID (least significant byte) | |
# operand[3] See 1 See 1 vendor dependent data | |
# ... | |
# operand[n] | |
# | |
# 1: Vendor dependent | |
# | |
# Figure 35 – VENDOR-DEPENDENT command frame | |
# | |
# | |
# 9.6.1.1 Field definitions | |
# company_ID: The company_ID field shall contain the 24-bit unique ID obtained | |
# from the IEEE Registration Authority Committee (RAC). The value of | |
# company_ID provided in the operands of VENDOR-DEPENDENT commands indicates | |
# the company or the organization that defines the VENDOR-DEPENDENT command. | |
# The most significant part of the company_ID is stored in operand[0] and | |
# the least significant part in operand[2]. vendor_dependent_data: The | |
# format and meaning of the vendor_dependent_data field are specified by | |
# the vendor identified by company_ID. Although the behavior of | |
# VENDOR-DEPENDENT commands is beyond the scope of this specification, it | |
# is recommended that VENDOR-DEPENDENT commands are defined in the same | |
# five command types, CONTROL, SPECIFIC INQUIRY, STATUS, NOTIFY and GENERAL | |
# INQUIRY, specified by the ctype field. | |
# | |
# | |
# company ID for TerraTec Electronic GmbH: | |
# operand[0]: 0x00 | |
# operand[1]: 0x0a | |
# operand[2]: 0xac | |
# | |
# | |
# Subfunctions of Vendor-dependent command for Terratec PHASE88 FW Rack: | |
# 0x21: Sync status. | |
# 0x22: Save Mixer settings to nonvolatile memory on the device. | |
# 0x23: Enable/Disable control by MIDI input messages | |
# 0x24: Assignment of MIDI channels to control elements | |
# 0x25: Default routing between inputs to outputs | |
# 0x26: Device ID at multiple Terratec models on the same IEEE 1394 bus | |
# | |
# Parameters for each subfunctions: | |
# 0x21: 1: Status | |
# 0x22: 0: (Nothing) | |
# 0x23: 1: Enable/Disable | |
# 0x24: 2: Control element ID/MIDI Control Change number | |
# 0x25: 2: Input ID/Output ID | |
# 0x26: 1: Arbitrary device ID | |
# | |
# | |
if [ $# -lt 2 ] ; then | |
echo 'At least two parameters are required.' | |
echo './phase88-specific.sh [set|get] [status|save|control|assign|route|id] [arguments...]' | |
exit 1 | |
fi | |
# get = STATUS command | |
if [[ $1 == 'get' ]] ; then | |
req=0x01 | |
# set = CONTROL command | |
elif [[ $1 == 'set' ]] ; then | |
req=0x00 | |
else | |
echo 'Invalid request type' | |
exit 1 | |
fi | |
if [[ $2 == 'status' ]] ; then | |
cmd=0x21 | |
elif [[ $2 == 'save' ]] ; then | |
cmd=0x22 | |
elif [[ $2 == 'control' ]] ; then | |
cmd=0x23 | |
elif [[ $2 == 'assign' ]] ; then | |
cmd=0x24 | |
elif [[ $2 == 'route' ]] ; then | |
cmd=0x25 | |
elif [[ $2 == 'id' ]] ; then | |
cmd=0x26 | |
else | |
echo 'Invalid command type' | |
exit 1; | |
fi | |
arg1=0 | |
arg2=0 | |
if [[ $req == 'set' ]] ; then | |
if [ $cmd -eq 0x21 ] && [ $# -eq 3 ]; then | |
arg1=$3 | |
elif [ $cmd -eq 0x22 ] && [ $# -eq 2 ] ; then | |
: | |
elif [ $cmd -eq 0x23 ] && [ $# -eq 3 ]; then | |
arg1=$3 | |
elif [ $cmd -eq 0x24 ] && [ $# -eq 4 ]; then | |
arg1=$3 | |
arg2=$4 | |
elif [ $cmd -eq 0x25 ] && [ $# -eq 4 ]; then | |
arg1=$3 | |
arg2=$4 | |
elif [ $cmd -eq 0x26 ] && [ $# -eq 3 ]; then | |
arg1=$3 | |
else | |
echo 'Invalid combination between command type and arguments' | |
exit 1; | |
fi | |
fi | |
request=$(printf "%02xff00000aac%02x%02x%02x000000" $req $cmd $arg1 $arg2) | |
echo $request | |
./firewire-request /dev/fw1 fcp $request |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment