kinect-audio-setup.git
8 years agoDrop the Changelog file and use a NEWS file v0.4
Antonio Ospite [Tue, 5 Jan 2016 21:29:52 +0000 (22:29 +0100)]
Drop the Changelog file and use a NEWS file

The NEWS file is intended for humans, all the other species can look at
the git history.

There is no need to keep a detailed Changelog around which is the exact
copy of the git history anyways.

8 years agokinect_upload_fw: detach possible kernel drivers
Antonio Ospite [Tue, 5 Jan 2016 22:43:04 +0000 (23:43 +0100)]
kinect_upload_fw: detach possible kernel drivers

8 years agokinect_upload_fw: make libusb initialization more robust
Antonio Ospite [Tue, 5 Jan 2016 22:41:07 +0000 (23:41 +0100)]
kinect_upload_fw: make libusb initialization more robust

Check the return values of all the libusb functions.

Also return more sensible values when ret is not immediately useful.

8 years agokinect_upload_fw: return -errno when fopen fails
Antonio Ospite [Tue, 5 Jan 2016 22:25:43 +0000 (23:25 +0100)]
kinect_upload_fw: return -errno when fopen fails

This way all the error paths return negative codes.

8 years agokinect_upload_fw: some cosmetic changes
Antonio Ospite [Tue, 5 Jan 2016 22:20:36 +0000 (23:20 +0100)]
kinect_upload_fw: some cosmetic changes

Adjust the code style a little bit, no functional changes.

8 years agokinect_upload_fw: rename "res" to "ret" in main()
Antonio Ospite [Tue, 5 Jan 2016 22:15:00 +0000 (23:15 +0100)]
kinect_upload_fw: rename "res" to "ret" in main()

For me it's more a return value than the actual result of some operation.

8 years agokinect_upload_fw: factor out an upload_firmware function
Antonio Ospite [Tue, 5 Jan 2016 22:11:53 +0000 (23:11 +0100)]
kinect_upload_fw: factor out an upload_firmware function

8 years agokinect_upload_fw: fix some warnings from clang -Weverything
Antonio Ospite [Tue, 5 Jan 2016 22:02:53 +0000 (23:02 +0100)]
kinect_upload_fw: fix some warnings from clang -Weverything

8 years agokinect_upload_fw: Makefile: don't enable unsupported options with clang
Antonio Ospite [Tue, 5 Jan 2016 22:02:14 +0000 (23:02 +0100)]
kinect_upload_fw: Makefile: don't enable unsupported options with clang

8 years agokinect_upload_fw: check the return value of get_first_reply() and get_reply()
Antonio Ospite [Tue, 5 Jan 2016 22:01:07 +0000 (23:01 +0100)]
kinect_upload_fw: check the return value of get_first_reply() and get_reply()

8 years agokinect_upload_fw: release the interface when exiting
Antonio Ospite [Tue, 5 Jan 2016 20:54:05 +0000 (21:54 +0100)]
kinect_upload_fw: release the interface when exiting

8 years agokinect_upload_fw: use symbolic constants instead of magic values
Antonio Ospite [Tue, 5 Jan 2016 20:39:48 +0000 (21:39 +0100)]
kinect_upload_fw: use symbolic constants instead of magic values

8 years agokinect_upload_fw: initialize current_configuration before libusb_get_configuration()
Antonio Ospite [Tue, 5 Jan 2016 19:08:18 +0000 (20:08 +0100)]
kinect_upload_fw: initialize current_configuration before libusb_get_configuration()

Initialize the variable as suggested by http://libusb.sourceforge.net/api-1.0/caveats.html

11 years agokinect_upload_fw: fix setting configuration for some devices
Kristof Robot [Sun, 8 Dec 2013 14:46:50 +0000 (15:46 +0100)]
kinect_upload_fw: fix setting configuration for some devices

On some Kinect devices where the desired configuration is already the
currently active one libusb_set_configuration() fails in some way
causing the subsequent bulk transfer to fail, and the program to exit,
with this message:

  libusbx: error [op_set_configuration] failed, error -1 errno 110
  About to send: 09 20 02 06 01 00 00 00 60 00 00 00 00 00 00 00 15 00 00 00 00 00 00 00
  libusbx: error [submit_bulk_transfer] submiturb failed error -1 errno=2
  Error: res: -1    transferred: 0 (expected 24)

Only set the desired configuration if it hasn't been set already.
This prevents the problems from above.

Do the configuration check as illustrated in
http://libusbx.sourceforge.net/api-1.0/caveats.html that is by checking
that the current configuration is still the desired one after claiming
the device.

11 years agoChangeLog: refresh for v0.3 v0.3
Antonio Ospite [Fri, 6 Dec 2013 16:46:39 +0000 (17:46 +0100)]
ChangeLog: refresh for v0.3

11 years agoMakefile: remove a trailing space
Antonio Ospite [Fri, 6 Dec 2013 16:45:36 +0000 (17:45 +0100)]
Makefile: remove a trailing space

11 years agoMakefile: don't create the empty dir /lib/firmware/kinect
Antonio Ospite [Fri, 6 Dec 2013 16:43:22 +0000 (17:43 +0100)]
Makefile: don't create the empty dir /lib/firmware/kinect

Let kinect_fetch_fw create the frmware destination dir when necessary.

11 years agokinect_upload_fw/Makefile: fix double spacing
Antonio Ospite [Fri, 6 Dec 2013 16:42:43 +0000 (17:42 +0100)]
kinect_upload_fw/Makefile: fix double spacing

Remove a double space before an assignment.

11 years agokinect_upload_fw/endian.c: fix warning and rename a function
Antonio Ospite [Fri, 6 Dec 2013 16:36:12 +0000 (17:36 +0100)]
kinect_upload_fw/endian.c: fix warning and rename a function

Remove the bigend() function, it is never used and causes a compiler
warning:

  endian.c:10:12: warning: ‘bigend’ defined but not used [-Wunused-function]
   static int bigend(void) {

Also rename the litend() function to little_endian(), there is no need
to use a short name in this case.

11 years agoREADME: reword and re-indent some paragraphs
Antonio Ospite [Tue, 19 Nov 2013 15:16:18 +0000 (16:16 +0100)]
README: reword and re-indent some paragraphs

11 years agoMakefile: misc fixes
Antonio Ospite [Tue, 19 Nov 2013 15:02:39 +0000 (16:02 +0100)]
Makefile: misc fixes

Use $(MAKE) for recursive invocations, fix a typo s/prare/prepare/, and
fix wording in a comment.

12 years agokinect_upload_fw: initialize 'transferred' before USB transfers
Antonio Ospite [Thu, 23 Feb 2012 21:48:22 +0000 (22:48 +0100)]
kinect_upload_fw: initialize 'transferred' before USB transfers

This makes sure the subsequent error messages print a sane value when
libusb fails without touching the variable.

12 years agoREADME: acknowledge Steven Toth's sponsorship
Antonio Ospite [Fri, 3 Feb 2012 12:12:01 +0000 (13:12 +0100)]
README: acknowledge Steven Toth's sponsorship

12 years agokinect_fetch_fw: mention that p7zip-full >= 9.20 is needed
Antonio Ospite [Wed, 28 Dec 2011 11:17:52 +0000 (12:17 +0100)]
kinect_fetch_fw: mention that p7zip-full >= 9.20 is needed

With earlier versions the firmware cannot be extracted from the .msi
file.

12 years agoREADME: mention reloading udev rules
Antonio Ospite [Wed, 28 Dec 2011 11:14:06 +0000 (12:14 +0100)]
README: mention reloading udev rules

After the firmware has been downloaded and the udev rules installed,
udevd must be told to reload the rules to actually handle the Kinect
audio device.

13 years agoAdd ChangeLog for v0.2 v0.2
Antonio Ospite [Sun, 27 Nov 2011 11:16:20 +0000 (12:16 +0100)]
Add ChangeLog for v0.2

13 years agokinect_fetch_fw: tell where we are getting the firmware from
Antonio Ospite [Sun, 27 Nov 2011 09:23:30 +0000 (10:23 +0100)]
kinect_fetch_fw: tell where we are getting the firmware from

13 years agoREADME: tell where we are getting the actual firmware from
Antonio Ospite [Sun, 27 Nov 2011 09:11:51 +0000 (10:11 +0100)]
README: tell where we are getting the actual firmware from

13 years agoREADME: fix a typo and add some clarifications
Antonio Ospite [Sun, 27 Nov 2011 09:10:28 +0000 (10:10 +0100)]
README: fix a typo and add some clarifications

13 years agokinect_fetch_fw: make the script less verbose when invoking 7z
Antonio Ospite [Sun, 27 Nov 2011 08:59:04 +0000 (09:59 +0100)]
kinect_fetch_fw: make the script less verbose when invoking 7z

13 years agokinect_fetch_fw: download the latest KinectSDK-v1.0-beta2-x86.msi
Antonio Ospite [Sun, 27 Nov 2011 08:46:38 +0000 (09:46 +0100)]
kinect_fetch_fw: download the latest KinectSDK-v1.0-beta2-x86.msi

13 years agokinect_fetch_fw: mention wget in the internal documentation
Antonio Ospite [Sun, 27 Nov 2011 08:45:54 +0000 (09:45 +0100)]
kinect_fetch_fw: mention wget in the internal documentation

13 years agokinect_upload_fw: specify libraries after objects in the linking command
Antonio Ospite [Sat, 26 Nov 2011 23:34:57 +0000 (00:34 +0100)]
kinect_upload_fw: specify libraries after objects in the linking command

When some options, like -Wl,--as-needed, are passed to the compiler (and
then to the liker) the order of linking options becomes important:
libraries must be specified after the objects in the linking command.

The implicit rule used was more or less:
  kinect_upload_fw: kinect_upload_fw.o
      $(CC) $(LDFLAGS) $^ $(LOADLIBES) $(LDLIBS) -o $@

with LDFLAGS expanded before $^ (the objects); use LDLIBS to specify the
libraries instead, which is expanded after $^.

More details in
http://ao2.it/it/blog/2011/11/27/dont-mix-ldflags-and-ldlibs

13 years agoAdd info about building kinect_upload_fw for MS Windows
Antonio Ospite [Fri, 4 Nov 2011 23:10:30 +0000 (00:10 +0100)]
Add info about building kinect_upload_fw for MS Windows

13 years agoUpdate .gitignore
Antonio Ospite [Fri, 4 Nov 2011 22:59:19 +0000 (23:59 +0100)]
Update .gitignore

Add endian and endian.h, add any *.o file and even *.exe ones as we are
going to add instructions about how to build kinect_upload_fw on MS
Windows too.

13 years agokinect_upload_fw: fix reading the firmware file on Windows
Antonio Ospite [Fri, 21 Oct 2011 20:19:37 +0000 (22:19 +0200)]
kinect_upload_fw: fix reading the firmware file on Windows

In MS Windows fread() behaves differently than on UNIX systems when
reading binary files if we do not specify "b" in the mode when opening
the file.

Quoting FOPEN(3) man page:

 ... the 'b' is ignored on all POSIX conforming systems, including
 Linux. (Other systems may treat text files and binary files
 differently, and adding the 'b' may be a good idea if you do I/O to a
 binary file and expect that your program may be ported to non-UNIX
 environments.)

13 years agokinect_upload_fw: fix a mingw32 compilation error
Antonio Ospite [Fri, 14 Oct 2011 19:57:12 +0000 (21:57 +0200)]
kinect_upload_fw: fix a mingw32 compilation error

When compiling with i586-mingw32msvci-g++ We get these errors:

kinect_upload_fw.c: In function ‘int main(int, char**)’:
kinect_upload_fw.c:236: error: jump to label ‘cleanup’
kinect_upload_fw.c:179: error:   from here
kinect_upload_fw.c:185: error:   crosses initialization of ‘uint32_t addr’
kinect_upload_fw.c:238: error: jump to label ‘fail_libusb_open’
kinect_upload_fw.c:155: error:   from here
kinect_upload_fw.c:185: error:   crosses initialization of ‘uint32_t addr’

Declaring and initializing a variable in the same statement after a goto
is allowed in C but not in C++; look at C++ specification Section 6.7
Paragraph 3.
(http://www.kuzbass.ru:8086/docs/isocpp/stmt.html#stmt.dcl)

Work around that by splitting 'addr' declaration and initialization.

13 years agokinect_upload_fw: fix generating endian.h before compiling kinect_upload_fw
Antonio Ospite [Thu, 13 Oct 2011 21:35:10 +0000 (23:35 +0200)]
kinect_upload_fw: fix generating endian.h before compiling kinect_upload_fw

Generate endian.h before compiling kinect_upload_fw, this is how it
should have been done from the start.

Until now the system-wide endian.h was being picked up instead, making
the whole compile-time-endian-detection mechanism useless; now we are
actually using it.

13 years agokinect_upload_fw: disable some compiler flags
Antonio Ospite [Thu, 13 Oct 2011 21:31:11 +0000 (23:31 +0200)]
kinect_upload_fw: disable some compiler flags

Disable some compiler flags to be more compatible with older setups:

  - vanilla libusb-1.0.8 makes compilation fail with -pedantic-errors

  - gcc versions older than 4.6 do not have -Wunused-but-set-variable

13 years agoAdd ChangeLog for v0.1 v0.1
Antonio Ospite [Wed, 12 Oct 2011 10:13:34 +0000 (12:13 +0200)]
Add ChangeLog for v0.1

13 years agokinect_upload_fw: fix a couple of minor warnings from 'sparse'
Antonio Ospite [Thu, 6 Oct 2011 12:49:01 +0000 (14:49 +0200)]
kinect_upload_fw: fix a couple of minor warnings from 'sparse'

Sparse is a Semantic Parser for C, it gives these warnings on
kinect_upload_fw.c:

kinect_upload_fw.c:42:14: warning: symbol 'seq' was not declared. Should it be static?
kinect_upload_fw.c:149:26: warning: Using plain integer as NULL pointer

13 years agokinect_upload_fw: support architectures that are not little-endian
Antonio Ospite [Mon, 3 Oct 2011 14:22:36 +0000 (16:22 +0200)]
kinect_upload_fw: support architectures that are not little-endian

Add an endian.c program which will be used at compile time to generate
an endian.h file with the information about the endianness of the
architecture. This way we do not depend on any particular build system
to retrieve this information (libfreenect knows the endianness with the
help of Cmake, for instance).

This is inspired from the rdesktop project[1] and looks more portable
than relying on the system endian.h as its use is relatively new and not
standardized yet, even though there are proposals in that direction[2].

Finally fn_le32() implementation is ripped off from libfreenect.

[1] http://www.rdesktop.org/archive/2001/msg00722.html
[2] http://austingroupbugs.net/view.php?id=162

13 years agokinect_fetch_fw: add a mechanism to check the integrity of the downloaded file
Antonio Ospite [Mon, 3 Oct 2011 13:55:28 +0000 (15:55 +0200)]
kinect_fetch_fw: add a mechanism to check the integrity of the downloaded file

13 years agokinect_fetch_fw: print error messages on stderr
Antonio Ospite [Mon, 3 Oct 2011 13:47:53 +0000 (15:47 +0200)]
kinect_fetch_fw: print error messages on stderr

13 years agokinect_upload_fw: really fix -Wformat warnings about sizeof()
Antonio Ospite [Fri, 30 Sep 2011 21:00:42 +0000 (23:00 +0200)]
kinect_upload_fw: really fix -Wformat warnings about sizeof()

Use "%zu" when printing the result of a sizeof(), this way the integer
conversion is done correctly taking into account the particular
architecture.

On a PPC64 (PlayStation 3) we were getting:

kinect_upload_fw.c: In function ‘get_reply’:
kinect_upload_fw.c:99:3: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘unsigned int’ [-Wformat]
kinect_upload_fw.c: In function ‘main’:
kinect_upload_fw.c:169:3: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘unsigned int’ [-Wformat]
kinect_upload_fw.c:194:4: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘unsigned int’ [-Wformat]
kinect_upload_fw.c:220:3: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘unsigned int’ [-Wformat]

13 years agokinect_upload_fw: fix issues shown by valgrind --leak-check=full --show-reachable=yes
Antonio Ospite [Fri, 30 Sep 2011 11:59:17 +0000 (13:59 +0200)]
kinect_upload_fw: fix issues shown by valgrind --leak-check=full --show-reachable=yes

Fix a "possibly lost" issue due to a missing call to libusb_exit() when
exiting after libusb_open_device_with_vid_pid() fails.

Fix a "still reachable" issue due to a missing fclose().

13 years agokinect_upload_fw: cosmetic changes
Antonio Ospite [Fri, 30 Sep 2011 11:43:52 +0000 (13:43 +0200)]
kinect_upload_fw: cosmetic changes

  - Spaces after contitionals
  - Spaces after commas
  - Some newlines to increase readability
  - Print a error message to stderr

13 years agokinect_upload_fw: print more meaningful error message on failure
Antonio Ospite [Fri, 30 Sep 2011 11:38:42 +0000 (13:38 +0200)]
kinect_upload_fw: print more meaningful error message on failure

13 years agokinect_fetch_fw: return value from $() does not need to be quoted
Antonio Ospite [Fri, 30 Sep 2011 11:26:48 +0000 (13:26 +0200)]
kinect_fetch_fw: return value from $() does not need to be quoted

13 years agokinect_fetch_fw: make FW_DESTDIR an absolute path
Antonio Ospite [Fri, 30 Sep 2011 11:21:06 +0000 (13:21 +0200)]
kinect_fetch_fw: make FW_DESTDIR an absolute path

This allows passing relative paths as arguments and be sure they don't
end up being relative to the temporary directory.

Also remove the slash after DESTDIR to avoid double slash.

13 years agoChange description of kinect_fetch_fw
Antonio Ospite [Fri, 30 Sep 2011 10:54:46 +0000 (12:54 +0200)]
Change description of kinect_fetch_fw

13 years agoAdd more info in the README file
Antonio Ospite [Fri, 30 Sep 2011 09:31:01 +0000 (11:31 +0200)]
Add more info in the README file

13 years agokinect_upload_fw: fix a -Wstrict-aliasing warning
Antonio Ospite [Thu, 29 Sep 2011 21:20:26 +0000 (23:20 +0200)]
kinect_upload_fw: fix a -Wstrict-aliasing warning

kinect_upload_fw.c:87:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

Use a union when there is the need to use the same memory for variables
of incompatible types (especially if they have different storage size).

13 years agokinect_upload_fw: fix assigning a string literal to a 'char *'
Antonio Ospite [Thu, 29 Sep 2011 21:13:09 +0000 (23:13 +0200)]
kinect_upload_fw: fix assigning a string literal to a 'char *'

kinect_upload_fw.c:118:19: error: initialization discards ‘const’ qualifier from pointer target type

A string literals can be seen as "const char *" or as array of chars,
I like the second interpretation better.

13 years agokinect_upload_fw: fix -Wsign-compare and -Wpointer-sign
Antonio Ospite [Thu, 29 Sep 2011 21:11:21 +0000 (23:11 +0200)]
kinect_upload_fw: fix -Wsign-compare and -Wpointer-sign

kinect_upload_fw.c:99:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
kinect_upload_fw.c:188:4: error: pointer targets in passing argument 3 of ‘libusb_bulk_transfer’ differ in signedness [-Wpointer-sign]

13 years agokinect_upload_fw: fix -Wformat warnings
Antonio Ospite [Thu, 29 Sep 2011 21:09:48 +0000 (23:09 +0200)]
kinect_upload_fw: fix -Wformat warnings

kinect_upload_fw.c:92:3: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long unsigned int’ [-Wformat]
kinect_upload_fw.c:157:3: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long unsigned int’ [-Wformat]
kinect_upload_fw.c:182:4: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long unsigned int’ [-Wformat]
kinect_upload_fw.c:208:3: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long unsigned int’ [-Wformat]

13 years agokinect_upload_fw: fix -Wmissing-prototypes warning
Antonio Ospite [Thu, 29 Sep 2011 21:05:58 +0000 (23:05 +0200)]
kinect_upload_fw: fix -Wmissing-prototypes warning

kinect_upload_fw.c:60:6: warning: no previous prototype for ‘dump_bl_cmd’ [-Wmissing-prototypes]
kinect_upload_fw.c:67:5: warning: no previous prototype for ‘get_first_reply’ [-Wmissing-prototypes]
kinect_upload_fw.c:86:5: warning: no previous prototype for ‘get_reply’ [-Wmissing-prototypes]

GCC emits "missing-prototypes" argument for _public_ functions without a
prototype, making them static is the right fix here.

13 years agokinect_upload_fw: fix -Wold-style-definition warnings
Antonio Ospite [Thu, 29 Sep 2011 21:04:24 +0000 (23:04 +0200)]
kinect_upload_fw: fix -Wold-style-definition warnings

kinect_upload_fw.c:67:5: warning: old-style function definition [-Wold-style-definition]
kinect_upload_fw.c:86:5: warning: old-style function definition [-Wold-style-definition]

13 years agokinect_upload_fw: fix spacing in Makefile, use simple expansion to set bindir
Antonio Ospite [Thu, 29 Sep 2011 20:06:26 +0000 (22:06 +0200)]
kinect_upload_fw: fix spacing in Makefile, use simple expansion to set bindir

13 years agokinect_upload_fw: enable more warnings in Makefile
Antonio Ospite [Thu, 29 Sep 2011 20:05:35 +0000 (22:05 +0200)]
kinect_upload_fw: enable more warnings in Makefile

13 years agokinect_upload_fw: remove some trailing spaces
Antonio Ospite [Sat, 17 Sep 2011 19:46:55 +0000 (21:46 +0200)]
kinect_upload_fw: remove some trailing spaces

13 years agoMakefile: Add a rule to generate a GNU style Changelog
Antonio Ospite [Thu, 29 Sep 2011 16:19:23 +0000 (18:19 +0200)]
Makefile: Add a rule to generate a GNU style Changelog

Lintian, the Debian package checker issues a warning when the upstream
does not provide a Changelog, now we can easily generate one for tagged
release using "make changelog".

13 years agoAdd a .gitignore file
Antonio Ospite [Sun, 11 Sep 2011 22:49:16 +0000 (00:49 +0200)]
Add a .gitignore file

13 years agoInitial import of the other pieces of knect_audio_setup
Antonio Ospite [Sun, 11 Sep 2011 18:42:39 +0000 (20:42 +0200)]
Initial import of the other pieces of knect_audio_setup

13 years agoInitial import of kinect_upload_fw
Drew Fisher [Sun, 11 Sep 2011 18:35:19 +0000 (20:35 +0200)]
Initial import of kinect_upload_fw

kinect_upload_fw is a program to upload the Usb Audio Class firmware to
the Microsoft Kinect sensor device. Before the firmware is uploaded the
device shows up as a generic usb device with a bulk endpoint, after the
firmware upload a reenumeration takes place and a Usb Audio Class device
becomes available.