File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 11import pytest
22import os
33import platform
4+ import glob
45
56import Adafruit_BBIO .PWM as PWM
67
@@ -16,7 +17,16 @@ def test_start_pwm(self):
1617 PWM .start ("P9_14" , 0 )
1718
1819 if kernel >= '4.1.0' :
19- pwm_dir = "/sys/devices/platform/ocp/48302000.epwmss/48302200.ehrpwm/pwm/pwmchip2/pwm0"
20+ # On 4.1+, the pwm subdirectory sometimes takes different names:
21+ # .pwm or .ehrpwm, etc.
22+ results = glob .glob (
23+ "/sys/devices/platform/ocp/48302000.*/" +
24+ "48302200.*/pwm/pwmchip2/pwm0" )
25+ # We expect that there will be a result (a directory fitting
26+ # our path exists) so test that with an assertion.
27+ assert len (results ) > 0
28+ # Continue with the pwm_dir found
29+ pwm_dir = results [0 ]
2030 else :
2131 files = os .listdir ('/sys/devices' )
2232 ocp = '/sys/devices/' + [s for s in files if s .startswith ('ocp' )][0 ]
You can’t perform that action at this time.
0 commit comments