Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a method to get a serial number from a device #554

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

piedar
Copy link
Contributor

@piedar piedar commented Mar 23, 2018

/**
 * Gets a serial number for the device.
 * The caller must free() the serial after use.
 *
 * @param dev
 * @return an appropriate serial number, or NULL if none was found.
 */
FREENECTAPI char* freenect_get_device_serial(freenect_device* dev);
char* serial = freenect_get_device_serial(fn_dev);
if (serial) printf("Found device with serial %s\n", serial);
free(serial);
$ bin/freenect-camtest
Found sibling device [same parent]
Found sibling device [same parent]
Found device with serial B00364216492048B

@svenevs
Copy link

svenevs commented Mar 23, 2018

@piedar thank you so much! I wish I could say I was close, but looking at the changes here...clearly not! I have some out of town visitors so probably won't be able to test this until late tonight or tomorrow.

I will try and back-port this as an external method (I'll need to spend a little more time with the code base first) so that pre v0.6.1 installations can still grab this if desired since that's what's packaged for most linux distributions. If I get that working I'll make sure to link a gist here!

@piedar
Copy link
Contributor Author

piedar commented Mar 23, 2018

@svenevs It will be good to get this tested more. I only verified it working with model 1414, and the others will possibly need audio firmware loaded before the call for it to work.

It might be tricky to backport as an external method because it required a fair bit of internal refactoring. The biggest hurdle was solved by adding libusb_dev* dev; to fnusb_dev so we always know which subdevices go with which device.


Also, I was considering making the API call more generic, like

FREENECTAPI int freenect_get_device_attributes(freenect_device* dev, freenect_device_attributes* attr);

so other attributes (VID, PID, etc) can be included in the future. It's a little messier to make sure everything gets freed though.

@svenevs
Copy link

svenevs commented Mar 23, 2018

It will be good to get this tested more.

Righto, I'll report back when I can install / run cam test.

The biggest hurdle was solved by adding libusb_dev* dev; to fnusb_dev so we always know which subdevices go with which device.

I see, I think this closes the gap in my confusion. Basically, prior to this addition getting this information is shaky / unreliable (or even impossible).

Also, I was considering making the API call more generic

I think given the changes here this would make sense to do.

AKA if the topic of the PR changes / takes longer to merge and get the others in, I'm happy to help test! But I don't think I understand enough to actually help implement the other attributes...

@svenevs
Copy link

svenevs commented Apr 28, 2018

Hi @piedar,

Sorry for the long delay here. TBH I'm really disappointed with myself right now. I can build libfreenect from source fine, but I cannot ever get anything to run. With dnf installed libfreenect, the freenect-glview program works as expected. When running the locally compiled version, I always get

$ ./bin/freenect-glview 
Kinect camera test
Skipping Kinect v2 device (needs https://github.com/libfreenect2).
Skipping Kinect v2 device (needs https://github.com/libfreenect2).
Number of devices found: 1
Found sibling device [same parent]
Failed to set the LED of K4W or 1473 device: LIBUSB_ERROR_IO
Found sibling device [same parent]
Could not open device: LIBUSB_ERROR_IO
Could not open device

This is the third time I've retried this in hopes to compile your PR and check what's going on. Do you have any advice as to why I would not be able to run the manually compiled executables?

@piedar
Copy link
Contributor Author

piedar commented Apr 28, 2018

@svenevs That's very strange indeed. I'll suggest trying a couple older versions like git checkout v0.5.7. And I wonder if the Fedora package provides audio firmware? You could try running fwfetcher.py and copying audios.bin to one of the searched firmware paths.

@piedar piedar added this to the v0.6.2 milestone Feb 16, 2020
@piedar piedar modified the milestones: v0.6.2, v0.6.3 Feb 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants