kinect_upload_fw/kinect_upload_fw
-kinect_upload_fw/*.o
+kinect_upload_fw/endian
+kinect_upload_fw/endian.h
+*.exe
+*.o
*~
*.swp
+2011-11-27 10:23:30 +0100 Antonio Ospite <ospite@studenti.unina.it>
+
+ * 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 <ospite@studenti.unina.it>
+
+ * README: tell where we are getting the actual firmware from
+
+2011-11-27 10:10:28 +0100 Antonio Ospite <ospite@studenti.unina.it>
+
+ * README: fix a typo and add some clarifications
+
+2011-11-27 09:59:04 +0100 Antonio Ospite <ospite@studenti.unina.it>
+
+ * kinect_fetch_fw: make the script less verbose when invoking 7z
+
+2011-11-27 09:46:38 +0100 Antonio Ospite <ospite@studenti.unina.it>
+
+ * kinect_fetch_fw: download the latest KinectSDK-v1.0-beta2-x86.msi
+
+2011-11-27 09:45:54 +0100 Antonio Ospite <ospite@studenti.unina.it>
+
+ * kinect_fetch_fw: mention wget in the internal documentation
+
+2011-11-27 00:34:57 +0100 Antonio Ospite <ospite@studenti.unina.it>
+
+ * kinect_upload_fw: specify libraries after objects in the linking command
+
+2011-11-05 00:10:30 +0100 Antonio Ospite <ospite@studenti.unina.it>
+
+ * Add info about building kinect_upload_fw for MS Windows
+
+2011-11-04 23:59:19 +0100 Antonio Ospite <ospite@studenti.unina.it>
+
+ * Update .gitignore
+
+2011-10-21 22:19:37 +0200 Antonio Ospite <ospite@studenti.unina.it>
+
+ * kinect_upload_fw: fix reading the firmware file on Windows
+
+2011-10-14 21:57:12 +0200 Antonio Ospite <ospite@studenti.unina.it>
+
+ * kinect_upload_fw: fix a mingw32 compilation error
+
+2011-10-13 23:35:10 +0200 Antonio Ospite <ospite@studenti.unina.it>
+
+ * kinect_upload_fw: fix generating endian.h before compiling kinect_upload_fw
+
+2011-10-13 23:31:11 +0200 Antonio Ospite <ospite@studenti.unina.it>
+
+ * kinect_upload_fw: disable some compiler flags
+
+2011-10-12 12:13:34 +0200 Antonio Ospite <ospite@studenti.unina.it>
+
+ * Add ChangeLog for v0.1 (v0.1)
+
2011-10-06 14:49:01 +0200 Antonio Ospite <ospite@studenti.unina.it>
- * 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 <ospite@studenti.unina.it>
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
# 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
# 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") <firmware destdir> [<path of kinect_upload_fw binary>]" 1>&2; exit 1; }
FW_DESTDIR=$(readlink -f $1)
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"
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)
-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 \
-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
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
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;
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 {
--- /dev/null
+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.
--- /dev/null
+REM First of all, make sure the drivers from ''libfreenect'' are installed, \r
+REM they are in ''platform/windows/inf'' in the libfreenect code base..\r
+REM \r
+REM Download the MSR Kinect SDK from:\r
+REM http://download.microsoft.com/download/8/4/C/84C9EF40-EE49-42C2-AE26-C6E30921182F/KinectSDK32.msi\r
+REM \r
+REM Explore ''KinectSDK32.msi'' using 7-zip from http://www.7-zip.org, extract the \r
+REM ''media1.cab'' file in it and get the firmware file, named ''UACFirmware.*''\r
+REM \r
+REM Put ''kinect_upload_fw.exe'', the firmware file and ''kinect_upload_fw.bat'' \r
+REM file in the same directory and double_click on the ''kinect_upload_fw.bat'' \r
+REM file.\r
+\r
+Set FIRMWARE="UACFirmware.C9C6E852_35A3_41DC_A57D_BDDEB43DFD04"\r
+\r
+kinect_upload_fw.exe %FIRMWARE%\r
+@PAUSE\r