From: Antonio Ospite Date: Sun, 27 Nov 2011 11:25:05 +0000 (+0100) Subject: Merge branch 'master' into debian X-Git-Tag: debian/0.2-1~4 X-Git-Url: https://git.ao2.it/kinect-audio-setup.git/commitdiff_plain/7a1307447e59692be2cc6373f8066b034336274c?hp=d12c99394cb86bbf9c0657a596a4a26fe2b1c16d Merge branch 'master' into debian --- diff --git a/.gitignore b/.gitignore index 4898bee..bc7ebc3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ kinect_upload_fw/kinect_upload_fw -kinect_upload_fw/*.o +kinect_upload_fw/endian +kinect_upload_fw/endian.h +*.exe +*.o *~ *.swp diff --git a/ChangeLog b/ChangeLog index fff466c..328da27 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,62 @@ +2011-11-27 10:23:30 +0100 Antonio Ospite + + * kinect_fetch_fw: tell where we are getting the firmware from (HEAD, origin/master, origin/HEAD, master) + +2011-11-27 10:11:51 +0100 Antonio Ospite + + * README: tell where we are getting the actual firmware from + +2011-11-27 10:10:28 +0100 Antonio Ospite + + * README: fix a typo and add some clarifications + +2011-11-27 09:59:04 +0100 Antonio Ospite + + * kinect_fetch_fw: make the script less verbose when invoking 7z + +2011-11-27 09:46:38 +0100 Antonio Ospite + + * kinect_fetch_fw: download the latest KinectSDK-v1.0-beta2-x86.msi + +2011-11-27 09:45:54 +0100 Antonio Ospite + + * kinect_fetch_fw: mention wget in the internal documentation + +2011-11-27 00:34:57 +0100 Antonio Ospite + + * kinect_upload_fw: specify libraries after objects in the linking command + +2011-11-05 00:10:30 +0100 Antonio Ospite + + * Add info about building kinect_upload_fw for MS Windows + +2011-11-04 23:59:19 +0100 Antonio Ospite + + * Update .gitignore + +2011-10-21 22:19:37 +0200 Antonio Ospite + + * kinect_upload_fw: fix reading the firmware file on Windows + +2011-10-14 21:57:12 +0200 Antonio Ospite + + * kinect_upload_fw: fix a mingw32 compilation error + +2011-10-13 23:35:10 +0200 Antonio Ospite + + * kinect_upload_fw: fix generating endian.h before compiling kinect_upload_fw + +2011-10-13 23:31:11 +0200 Antonio Ospite + + * kinect_upload_fw: disable some compiler flags + +2011-10-12 12:13:34 +0200 Antonio Ospite + + * Add ChangeLog for v0.1 (v0.1) + 2011-10-06 14:49:01 +0200 Antonio Ospite - * kinect_upload_fw: fix a couple of minor warnings from 'sparse' (v0.1) + * kinect_upload_fw: fix a couple of minor warnings from 'sparse' 2011-10-03 16:22:36 +0200 Antonio Ospite diff --git a/README b/README index 46e18cf..306e480 100644 --- a/README +++ b/README @@ -1,9 +1,9 @@ kinect-audio-setup makes audio input from the Microsoft Kinect Sensor -device work on GNU/linux systems. +device work on GNU/Linux systems. When the Kinect is first plugged in the USB port it shows up as a generic USB device with a bulk endpoint; after uploading a certain -firmware a reenumeration takes place and a USB Audio Class device +firmware a reenumeration takes place and a USB Audio Class (UAC) device becomes available. kinect-audio-setup provides tools to download the firmware off the net @@ -31,7 +31,15 @@ Install kinect_upload_fw first: # make install +it will be copied to /usr/local/sbin by default, assign the PREFIX +variable on the command line to install it to another location. + Then run the firmware fetcher script (remember this is only needed once): # ./kinect_fetch_fw /lib/firmware/kinect + + +The UAC firmware is downloaded from the Microsoft Kinect SDK at +http://www.kinectforwindows.org, the license of the SDK can be found at +http://www.kinectforwindows.org/download/EULA.htm diff --git a/kinect_fetch_fw b/kinect_fetch_fw index 6db228f..a358327 100755 --- a/kinect_fetch_fw +++ b/kinect_fetch_fw @@ -10,13 +10,13 @@ # To Public License, Version 2, as published by Sam Hocevar. See # http://sam.zoy.org/wtfpl/COPYING for more details. # -# 7z from p7zip-full is needed, it can be installed with -# sudo aptitude install p7zip-full +# wget and 7z from p7zip-full are needed, they can be installed with +# sudo aptitude install wget p7zip-full set -e -SDK_URL=${SDK_URL:-"http://download.microsoft.com/download/8/4/C/84C9EF40-EE49-42C2-AE26-C6E30921182F/KinectSDK32.msi"} -SDK_MD5="a043c40f35bf14a5139dfbf6cb14f687" +SDK_URL=${SDK_URL:-"http://download.microsoft.com/download/F/9/9/F99791F2-D5BE-478A-B77A-830AD14950C3/KinectSDK-v1.0-beta2-x86.msi"} +SDK_MD5="40764fe9e00911bda5095e5be777e311" [ $# -lt 1 ] && { echo "usage: $(basename "$0") []" 1>&2; exit 1; } FW_DESTDIR=$(readlink -f $1) @@ -29,6 +29,17 @@ TEMPDIR=$(mktemp -d) trap 'rm -rf "$TEMPDIR" >/dev/null 2>&1' 0 trap "exit 2" 1 2 3 15 +cat << EOM + +This script is going to download the UAC Firmware for the Microsoft +Kinect Sensor device from the Microsoft Kinect for Windows SDK: +http://kinectforwindows.org/ + +The full license of the SDK can be found at: +http://www.kinectforwindows.org/download/EULA.htm + +EOM + cd "$TEMPDIR" ARCHIVE_NAME=$(basename "$SDK_URL") rm -f "$ARCHIVE_NAME" && wget "$SDK_URL" -O "$ARCHIVE_NAME" @@ -40,7 +51,9 @@ then exit 1 fi -7z e -y -r "$ARCHIVE_NAME" "UACFirmware.*" +echo -n "Extracting the UAC firmware..." +7z e -y -r "$ARCHIVE_NAME" "UACFirmware.*" > /dev/null +echo " done." FW_FILE=$(ls UACFirmware.* | cut -d ' ' -f 1) diff --git a/kinect_upload_fw/Makefile b/kinect_upload_fw/Makefile index e917d59..2cca6fd 100644 --- a/kinect_upload_fw/Makefile +++ b/kinect_upload_fw/Makefile @@ -1,4 +1,12 @@ -CFLAGS ?= -std=c99 -pedantic -pedantic-errors -Wall -Wextra -O2 +CFLAGS ?= -std=c99 -pedantic -Wall -Wextra -O2 + +# Don't make pedantic checks errors, +# as vanilla libusb-1.0.8 can't live with that +#CFLAGS += -pedantic-errors + +# GCC >= 4.6 +#CFLAGS += -Wunused-but-set-variable + CFLAGS += -fno-common \ -Wall \ -Wextra \ @@ -23,11 +31,10 @@ CFLAGS += -fno-common \ -Wundef \ -Wunreachable-code \ -Wunsafe-loop-optimizations \ - -Wunused-but-set-variable \ -Wwrite-strings CFLAGS += $(shell pkg-config --cflags libusb-1.0) -LDFLAGS += $(shell pkg-config --libs libusb-1.0) +LDLIBS += $(shell pkg-config --libs libusb-1.0) PREFIX ?= /usr/local bindir := $(PREFIX)/sbin @@ -41,7 +48,9 @@ endian.h: endian rm -f endian.h ./endian > endian.h -kinect_upload_fw: endian.h kinect_upload_fw.o +kinect_upload_fw.o: endian.h + +kinect_upload_fw: kinect_upload_fw.o install: kinect_upload_fw diff --git a/kinect_upload_fw/kinect_upload_fw.c b/kinect_upload_fw/kinect_upload_fw.c index 21bdef9..e544df4 100644 --- a/kinect_upload_fw/kinect_upload_fw.c +++ b/kinect_upload_fw/kinect_upload_fw.c @@ -139,7 +139,7 @@ int main(int argc, char** argv) { filename = argv[1]; } - FILE* fw = fopen(filename, "r"); + FILE* fw = fopen(filename, "rb"); if (fw == NULL) { fprintf(stderr, "Failed to open %s: %s\n", filename, strerror(errno)); return errno; @@ -182,7 +182,11 @@ int main(int argc, char** argv) { res = get_reply(); // I'm not sure why we do this twice here, but maybe it'll make sense later. seq++; - uint32_t addr = 0x00080000; + // Split addr declaration and assignment in order to compile as C++, + // otherwise this would give "jump to label '...' crosses initialization" + // errors. + uint32_t addr; + addr = 0x00080000; unsigned char page[0x4000]; int read; do { diff --git a/windows/README.asciidoc b/windows/README.asciidoc new file mode 100644 index 0000000..00ec5e4 --- /dev/null +++ b/windows/README.asciidoc @@ -0,0 +1,55 @@ +Cross-compiling kinect_upload_fw for Windows under Linux +======================================================== + +Adapted from http://www.tinc-vpn.org/examples/cross-compiling-windows-binary/ + +Installing the prerequisites for cross-compilation +-------------------------------------------------- + + sudo apt-get install mingw32 wine git-core + +Setting up the build directory and getting the dependencies: + + mkdir $HOME/mingw + cd $HOME/mingw + wget http://kinect.dashhacks.com/sites/kinect-hacks.com/files/libusb-win32-bin-1.2.2.0.zip + unzip libusb-win32-bin-1.2.2.0.zip + git clone git://github.com/OpenKinect/libfreenect.git --branch unstable + + +Compiling kinect_upload_fw +-------------------------- + + cd $HOME/mingw + git clone git://git.ao2.it/kinect-audio-setup.git + + cd kinect-audio-setup/kinect_upload_fw + CC=i586-mingw32msvc-gcc make endian LDFLAGS= + wine ./endian > endian.h + i586-mingw32msvc-g++ kinect_upload_fw.c -o kinect_upload_fw.exe \ + $HOME/mingw/libfreenect/platform/windows/libusb10emu/libusb-1.0/failguard.cpp \ + $HOME/mingw/libfreenect/platform/windows/libusb10emu/libusb-1.0/libusbemu.cpp \ + -I$HOME/mingw/libfreenect/platform/windows/libusb10emu/libusb-1.0 \ + -I$HOME/mingw/libfreenect/platform/windows/libusb10emu \ + -I$HOME/mingw/libusb-win32-bin-1.2.2.0/include \ + -I$HOME/mingw/libfreenect/include \ + -I$HOME/mingw/libfreenect/src \ + $HOME/mingw/libusb-win32-bin-1.2.2.0/lib/gcc/libusb.a + + +Using kinect_upload_fw.exe on Windows +------------------------------------- + +First of all, make sure the drivers from ''libfreenect'' are installed, they are +under ''platform/windows/inf''. + +Download the MSR Kinect SDK from: +http://download.microsoft.com/download/8/4/C/84C9EF40-EE49-42C2-AE26-C6E30921182F/KinectSDK32.msi + +Explore ''KinectSDK32.msi'' using 7-zip from http://www.7-zip.org, extract the +''media1.cab'' file in it and extract the firmware file from ''media1.cab'', the +firmware file is named ''UACFirmware.*''. + +Put ''kinect_upload_fw.exe'', the firmware file and ''kinect_upload_fw.bat'' +file in the same directory and double_click on the ''kinect_upload_fw.bat'' +file. diff --git a/windows/kinect_upload_fw.bat b/windows/kinect_upload_fw.bat new file mode 100644 index 0000000..3757670 --- /dev/null +++ b/windows/kinect_upload_fw.bat @@ -0,0 +1,17 @@ +REM First of all, make sure the drivers from ''libfreenect'' are installed, +REM they are in ''platform/windows/inf'' in the libfreenect code base.. +REM +REM Download the MSR Kinect SDK from: +REM http://download.microsoft.com/download/8/4/C/84C9EF40-EE49-42C2-AE26-C6E30921182F/KinectSDK32.msi +REM +REM Explore ''KinectSDK32.msi'' using 7-zip from http://www.7-zip.org, extract the +REM ''media1.cab'' file in it and get the firmware file, named ''UACFirmware.*'' +REM +REM Put ''kinect_upload_fw.exe'', the firmware file and ''kinect_upload_fw.bat'' +REM file in the same directory and double_click on the ''kinect_upload_fw.bat'' +REM file. + +Set FIRMWARE="UACFirmware.C9C6E852_35A3_41DC_A57D_BDDEB43DFD04" + +kinect_upload_fw.exe %FIRMWARE% +@PAUSE