wjasper / Linux_Drivers

Open source Linux device drivers
GNU General Public License v3.0
111 stars 64 forks source link

Too many bytes copied in usbGetAlarmConfig_USBTC_AI #15

Closed warr closed 6 years ago

warr commented 6 years ago

First of all, thanks for all your work over the years. There are two liquid nitrogen filling systems, which have been running at CERN for years using your code, keeping our detectors cold.

I just tried compiling with gcc8 and it gives a warning on the last line of usb-tc-ai.c and it looks like it is right. The memcpy copies sizeof(value_2) and value_2 is a pointer to float, so this is sizeof(float ). So on a 64-bit system, this is 8 bytes. Really, it should be copying sizeof(value_2) = sizeof(float), giving 4 bytes. Same for the previous line, though gcc didn't spot that since it was still within alarmConfig.

wjasper commented 6 years ago

Much thanks for the issue report. You are correct, should be returning 4 byte float. Problem fixed. By the way, Measurement Computing has asked me if I know of neat projects using my drivers. Detecting the temperature levels of liquid nitrogen tanks for detectors at CERN definitely fits that description. Would you mind emailing me off line and sending me a short paragraph (and a picture ?) of how the usb-tc-ai is used at CERN?

warr commented 6 years ago

Hi Warren,

Much thanks for the issue report. You are correct, should be returning 4 byte float. Problem fixed.

By the way, Measurement Computing has asked me if I know of neat projects using my drivers. Detecting the temperature levels of liquid nitrogen tanks for detectors at CERN definitely fits that description. Would you mind emailing me off line and sending me a short paragraph (and a picture ?) of how the usb-tc-ai is used at CERN?

Actually, we don't use the usb-tc-ai. I just noticed that, when compiling the rather old version of your code, that I had. So I looked at the latest version and saw it had the same issue and thought I'd let you know.

At ISOLDE in CERN, we use USB-TEMP modules to read out the temperature of the germanium detectors, which have to be kept at liquid nitrogen temperature all the time. We use a USB-DIO96H/50 to open and close the valves. At the Miniball experiment, there's one USB-DIO96H/50 and two USB-TEMP, while at the ISOLDE Decay Station experiment, there's one of each.

There are a few pictures in the online documentation:

http://www.ikp.uni-koeln.de/~warr/doc/autofill_hardware.pdf

The best picture of Miniball is on the CERN website:

http://isolde.web.cern.ch/sites/isolde.web.cern.ch/files/Miniball.jpg

For Miniball, we have eight cryostats each containing three high-purity germanium crystals. Each cryostat has a PT100 to read out the temperature at the crystal. These are read out by the USB-TEMP modules. The actual filling is done by the USB-DIO96H/50. It controls the valves that control the flow of liquid nitrogen in four manifolds. Each manifold has an inlet valve, a purge valve and valves for six detectors. So we have a lot more capacity than we need. There are also liquid nitrogen sensors at the outlets, which provide a bit indicating gas or liquid, which goes back to the USB-DIO96H/50.

The ISOLDE Decay Station setup is a reduced clone of the Miniball one; they have only one manifold and only one USB-TEMP module, but the hardware is the same and could be expanded in future.

Originally the software worked with some much older ISA cards, so when I ported it to use the USB modules, I was very glad that your drivers did all the work for me. Thanks again.

All the best, Nigel

-- Dr. Nigel Warr, Institut für Kernphysik, Universität zu Köln, Zülpicherstr. 77, D-50937 Köln, Germany. Tel +49 221 470 3459

wjasper commented 6 years ago

Hi Nigel, Much thanks for those links to Miniball. It's nice to see the great science you and your group do at CERN. Glad my drivers were able to play a small part and save you some time.

Best wishes, Warren