Skip to content

Commit 88aba0a

Browse files
committed
Remove legacy keep_alive.c; now require libusb >= 1.0.18
Signed-off-by: Benn Snyder <benn.snyder@gmail.com>
1 parent d071095 commit 88aba0a

File tree

6 files changed

+4
-251
lines changed

6 files changed

+4
-251
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Audio is a work in progress.
1616

1717
To build libfreenect, you'll need
1818

19-
- [libusb](http://libusb.info) >= 1.0.13
19+
- [libusb](http://libusb.info) >= 1.0.18
2020
- [CMake](http://cmake.org) >= 2.6
2121
- [python](http://python.org) == 2.* (only if BUILD_AUDIO or BUILD_PYTHON)
2222

src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
include_directories (${CMAKE_CURRENT_SOURCE_DIR})
66

77
include_directories(${LIBUSB_1_INCLUDE_DIRS})
8-
LIST(APPEND SRC core.c tilt.c cameras.c flags.c usb_libusb10.c registration.c keep_alive.c)
8+
LIST(APPEND SRC core.c tilt.c cameras.c flags.c usb_libusb10.c registration.c)
99
IF(WIN32)
1010
set_source_files_properties(${SRC} PROPERTIES LANGUAGE CXX)
1111
ENDIF(WIN32)

src/freenect_internal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ typedef void (*fnusb_iso_cb)(freenect_device *dev, uint8_t *buf, int len);
4545

4646
#include "usb_libusb10.h"
4747

48-
//needed to set the led state for non 1414 devices - replaces keep_alive.c
48+
// needed to set the led state for non 1414 devices
4949
FN_INTERNAL int fnusb_set_led_alt(libusb_device_handle * dev, freenect_context * ctx, freenect_led_options state);
5050

5151
struct _freenect_context {
@@ -56,7 +56,7 @@ struct _freenect_context {
5656
freenect_device *first;
5757
int zero_plane_res;
5858

59-
//if you want to load firmware from memory rather than disk
59+
// if you want to load firmware from memory rather than disk
6060
unsigned char * fn_fw_nui_ptr;
6161
unsigned int fn_fw_nui_size;
6262

src/keep_alive.c

Lines changed: 0 additions & 204 deletions
This file was deleted.

src/keep_alive.h

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/usb_libusb10.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#include <libusb.h>
3232
#include "freenect_internal.h"
3333
#include "loader.h"
34-
#include "keep_alive.h"
3534

3635
#ifdef _MSC_VER
3736
# define sleep(x) Sleep((x)*1000)
@@ -168,8 +167,6 @@ FN_INTERNAL int fnusb_is_pid_k4w_audio(int pid)
168167
return (pid == PID_K4W_AUDIO || pid == PID_K4W_AUDIO_ALT_1 || pid == PID_K4W_AUDIO_ALT_2);
169168
}
170169

171-
// fnusb_find_connected_audio_device uses new libusb features. we use guards to make sure its backwards compatible with older versions of libusb
172-
#if defined(LIBUSB_API_VERSION) && (LIBUSB_API_VERSION >= 0x01000102)
173170
FN_INTERNAL libusb_device * fnusb_find_connected_audio_device(libusb_device * camera, libusb_device ** deviceList, int cnt){
174171

175172
int cameraBusNo = libusb_get_bus_number(camera);
@@ -203,7 +200,6 @@ FN_INTERNAL libusb_device * fnusb_find_connected_audio_device(libusb_device * ca
203200

204201
return NULL;
205202
}
206-
#endif
207203

208204
FN_INTERNAL int fnusb_open_subdevices(freenect_device *dev, int index)
209205
{
@@ -266,10 +262,7 @@ FN_INTERNAL int fnusb_open_subdevices(freenect_device *dev, int index)
266262
dev->device_does_motor_control_with_audio = 1;
267263

268264
// set the LED for non 1414 devices to keep the camera alive for some systems which get freezes
269-
// this code replaces keep_alive.c, which didn't know which hub the connected audio device was on
270-
// fnusb_find_connected_audio_device needs libusb 1.0.18 or later
271265

272-
#if defined(LIBUSB_API_VERSION) && (LIBUSB_API_VERSION >= 0x01000102)
273266
libusb_device * audioDevice = fnusb_find_connected_audio_device(devs[i], devs, cnt);
274267
if (audioDevice != NULL)
275268
{
@@ -304,11 +297,6 @@ FN_INTERNAL int fnusb_open_subdevices(freenect_device *dev, int index)
304297
}
305298
}
306299
}
307-
#else
308-
// Legacy: for older versions of libusb we use this approach which doesn't do well when multiple K4W or 1473 devices are attached to the system.
309-
// also set the LED ON to keep the camera alive for some systems which get freezes
310-
freenect_extra_keep_alive((desc.idProduct == PID_K4W_CAMERA) ? PID_K4W_AUDIO : PID_NUI_AUDIO);
311-
#endif
312300

313301
#ifdef BUILD_AUDIO
314302
// for newer devices we need to enable the audio device for motor control

0 commit comments

Comments
 (0)