timofurrer / w1thermsensor

A Python package and CLI tool to work with w1 temperature sensors like DS1822, DS18S20 & DS18B20 on the Raspberry Pi, Beagle Bone and other devices.
MIT License
493 stars 113 forks source link

Automatically load kernel modules upon import #31

Closed timofurrer closed 7 years ago

codecov-io commented 7 years ago

Codecov Report

Merging #31 into master will decrease coverage by 0.93%. The diff coverage is 83.33%.

@@            Coverage Diff             @@
##           master      #31      +/-   ##
==========================================
- Coverage    62.2%   61.27%   -0.94%     
==========================================
  Files           4        4              
  Lines         172      173       +1     
==========================================
- Hits          107      106       -1     
- Misses         65       67       +2
Impacted Files Coverage Δ
w1thermsensor/core.py 97.11% <83.33%> (-1.92%) :x:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update cf52094...fd53e02. Read the comment docs.

bsimmo commented 7 years ago

I don't quite understand the need for this, at least in any usage case for me on a standard Raspian / RaspberryPi setup. These are auto loaded when you enable 1-wire on the Pi. Do i now have to run any program that imports this as 'su' or always have to remove this/alter a setting everytime I grab the code? (I cannot test at the moment).

timofurrer commented 7 years ago

It was already done during __init__ of a W1ThermSensor instance. Which lead to problems in case you want to check available sensors before actually creating a sensor.

So, this had to change and I didn't want to break existing code which relies on that behavior. I figured that's the best option.

Do i now have to run any program that imports this as 'su' or always have to remove this/alter a setting everytime I grab the code?

No, unless you haven't loaded the modules already! If they are already loaded you can just use the package without configuring anything special. I have to state that in the README as well.

bsimmo commented 7 years ago

Excellent :-)