@@ -204,9 +204,39 @@ FN_INTERNAL char* usb_get_serial(freenect_context* ctx, libusb_device* device, l
204
204
return NULL ;
205
205
}
206
206
207
+ const char * const K4W_1473_SERIAL = "0000000000000000" ;
208
+ if (strncmp ((const char * )serial , K4W_1473_SERIAL , 16 ) == 0 ) {
209
+ return NULL ; // K4W and 1473 provide an empty serial; more easily handled as NULL.
210
+ }
211
+
207
212
return strndup ((const char * )serial , sizeof (serial ));
208
213
}
209
214
215
+ FN_INTERNAL int fnusb_get_device_attributes (freenect_device * dev , struct freenect_device_attributes * attributes )
216
+ {
217
+ freenect_context * ctx = dev -> parent ;
218
+
219
+ int res = 0 ;
220
+
221
+ char * serial = usb_get_serial (ctx , NULL , dev -> usb_cam .dev , NULL );
222
+ if (serial == NULL )
223
+ {
224
+ char * audio_serial = usb_get_serial (ctx , NULL , dev -> usb_audio .dev , NULL );
225
+ if (audio_serial ) {
226
+ free (serial );
227
+ serial = audio_serial ;
228
+ }
229
+ }
230
+
231
+ if (serial == NULL ) {
232
+ return -1 ;
233
+ }
234
+
235
+ attributes -> next = NULL ;
236
+ attributes -> camera_serial = serial ;
237
+ return res ;
238
+ }
239
+
210
240
FN_INTERNAL int fnusb_list_device_attributes (freenect_context * ctx , struct freenect_device_attributes * * attribute_list )
211
241
{
212
242
* attribute_list = NULL ; // initialize some return value in case the user is careless.
@@ -240,10 +270,7 @@ FN_INTERNAL int fnusb_list_device_attributes(freenect_context *ctx, struct freen
240
270
}
241
271
242
272
char * serial = usb_get_serial (ctx , camera_device , NULL , & desc );
243
-
244
- // K4W and 1473 don't provide a camera serial; use audio serial instead.
245
- const char * const K4W_1473_SERIAL = "0000000000000000" ;
246
- if (serial == NULL || strncmp ((const char * )serial , K4W_1473_SERIAL , 16 ) == 0 )
273
+ if (serial == NULL )
247
274
{
248
275
libusb_device * audio_device = fnusb_find_sibling_device (ctx , camera_device , devs , count , & fnusb_is_audio );
249
276
if (audio_device != NULL )
0 commit comments