0

This question is related to what is expanded on here: User Space to Kernel Communication Without Call Back Function and here: Correct Approach To Turn Closed Source Library Into Kernel HWMon Driver Module. Basically I have a kernel module function that invokes a user space program that interfaces with a third party library to read sensor data. That sensor data needs to be sent back to the same kernel function that invoked the user space program. All methods of communicating with the kernel that I've read about involve call back functions which means the data doesn't end up in the calling function so the only solution seems to be to use the user space program return value to transfer the data. The only sensor data that doesn't seem to fit inside 8 bits is fan RPM values. 12 bits would give a max RPM value of 4096, although 13 bits would be better to give a larger range. This somehow needs to be transmitted via the 8 bit return value.

Obviously I'm gonna lose some information. My first thought is to round the number to the nearest 16 multiple thus basically losing the least significant 4 bits. However I'm wondering if there might be a better approach.

Harry Muscle
  • 2,247
  • 4
  • 38
  • 62
  • 1
    why do you ask this again? If it's closed then you need to provide more information so that it can be reopened https://stackoverflow.com/questions/69503168/sending-12-bit-number-in-8-bits – phuclv Oct 10 '21 at 03:48
  • I provided the additional details. I was under the impression the original message wasn't getting reviewed after the edit for some reason so it seemed quicker/easier to ask again with all the extra details added in. – Harry Muscle Oct 10 '21 at 03:56
  • 1
    no, that's not how SO works. By asking again and again you might be banned from asking new questions – phuclv Oct 10 '21 at 04:35

0 Answers0