Closed ximion closed 4 years ago
Thanks for looking into all of this @ximion! I'll test these changes out with a Miniscope connected to a Window's machine.
We have tested the new software and firmware on the V3 Miniscope and everything seemed to run fine so likely you not being able to control the V3 LED is still a Linux issue.
I'll test these changes out with a Miniscope connected to a Window's machine.
Yes, please - I was confident in the changes enough to open a PR, but wasn't able to test them at all. I'll play with this a bit more and next time upload a binary firmware blob to these changes so testing is easier for others.
We have tested the new software and firmware on the V3 Miniscope and everything seemed to run fine so likely you not being able to control the V3 LED is still a Linux issue.
Yeah, that would be the most logical - since V3 was tested, and the firmware didn't actually change much, it's highly likely still some kind of communication issue. Your comments in the Qt software PR were very helpful, maybe I can figure out what's going on, I'll maybe have another go at this next week. Quite possibly the cause of this bug is something dumb, like another value sanitization somewhere or an endianess issue. In any case, thanks a lot for your help and for permitting this work to happen in the first place by making all code available :-)
I figured out the issue, I think. New PR for the changes in this one and a few related ones: https://github.com/Aharoni-Lab/Miniscope-DAQ-Cypress-firmware/pull/2
Hi! This is a follow-up on https://github.com/Aharoni-Lab/Miniscope-DAQ-QT-Software/pull/4 I was investigating why the Miniscope software wasn't working on Linux, going through the layers of OpenCV -> v4l-libs -> kernel driver -> firmware and found out that there were two issues with the device:
bmControls
0xFFFF
is -1 in signed-int form, the system assumes a max value of -1 and a minimum value of 0. The driver performs value sanitization, clamping the sent values to their min/max range before the device sees them, so any value submitted by an application will be lost (same applies to values sent from the device) I have no idea why this particular issue isn't seen on Windows, apparently that OS is very forgiving.With these patches applied, I get zero warnings from the kernel when the device is plugged in. I can write all control values and read the same values back from the device. I can also watch the correct values being transferred when intercepting USB communication. And yet for some reason the LED intensity on my v3 Miniscope still doesn't change. I have never tested this on Windows, so there is a chance that the v3 support doesn't fully work on any platform. I will have to verify that somehow and then test again. Or maybe someone else has an idea what else could be wrong here (I haven't yet figured out how to debug the device itself while it's running).
In any case, these patches should already be helpful to some extent, and definitely resolve some issues on Linux. Thanks for considering! Cheers, Matthias
P.S: I had to resist the urge to clean up the repository (that -metadata folder should likley go into .gitignore) and fix the typo in the source folder name ^^