diff -Nru python-periphery-2.0.0/CHANGELOG.md python-periphery-2.0.1/CHANGELOG.md --- python-periphery-2.0.0/CHANGELOG.md 2019-10-29 03:46:27.000000000 +0000 +++ python-periphery-2.0.1/CHANGELOG.md 2020-01-08 06:41:59.000000000 +0000 @@ -1,3 +1,10 @@ +* v2.0.1 - 01/08/2020 + * PWM + * Add retry loop for opening PWM period file after export to + accommodate delayed udev permission rule application. + * Contributors + * Jonas Larsson, @jonasl - 28653d4 + * v2.0.0 - 10/28/2019 * GPIO * Add support for character device GPIOs. diff -Nru python-periphery-2.0.0/debian/changelog python-periphery-2.0.1/debian/changelog --- python-periphery-2.0.0/debian/changelog 2019-11-13 20:56:00.000000000 +0000 +++ python-periphery-2.0.1/debian/changelog 2020-01-22 20:48:09.000000000 +0000 @@ -1,3 +1,15 @@ +python-periphery (2.0.1-1) unstable; urgency=low + + [ Debian Janitor ] + * Set upstream metadata fields: Bug-Database, Bug-Submit, Repository, + Repository-Browse. + + [ Michael Fladischer ] + * New upstream release. + * Set Rules-Requires-Root: no. + + -- Michael Fladischer Wed, 22 Jan 2020 21:48:09 +0100 + python-periphery (2.0.0-1) unstable; urgency=low [ Ondřej Nový ] diff -Nru python-periphery-2.0.0/debian/control python-periphery-2.0.1/debian/control --- python-periphery-2.0.0/debian/control 2019-11-13 20:56:00.000000000 +0000 +++ python-periphery-2.0.1/debian/control 2020-01-22 20:48:09.000000000 +0000 @@ -15,6 +15,7 @@ Vcs-Browser: https://salsa.debian.org/python-team/modules/python-periphery Vcs-Git: https://salsa.debian.org/python-team/modules/python-periphery.git Testsuite: autopkgtest-pkg-python +Rules-Requires-Root: no Package: python3-periphery Architecture: all diff -Nru python-periphery-2.0.0/debian/upstream/metadata python-periphery-2.0.1/debian/upstream/metadata --- python-periphery-2.0.0/debian/upstream/metadata 1970-01-01 00:00:00.000000000 +0000 +++ python-periphery-2.0.1/debian/upstream/metadata 2020-01-22 20:48:09.000000000 +0000 @@ -0,0 +1,4 @@ +Bug-Database: https://github.com/vsergeev/python-periphery/issues +Bug-Submit: https://github.com/vsergeev/python-periphery/issues/new +Repository: https://github.com/vsergeev/python-periphery.git +Repository-Browse: https://github.com/vsergeev/python-periphery diff -Nru python-periphery-2.0.0/docs/conf.py python-periphery-2.0.1/docs/conf.py --- python-periphery-2.0.0/docs/conf.py 2019-10-29 03:46:27.000000000 +0000 +++ python-periphery-2.0.1/docs/conf.py 2020-01-08 06:41:59.000000000 +0000 @@ -21,7 +21,7 @@ author = u'Vanya A. Sergeev' # The short X.Y version. -version = '2.0.0' +version = '2.0.1' # The full version, including alpha/beta/rc tags. release = version diff -Nru python-periphery-2.0.0/docs/gpio.rst python-periphery-2.0.1/docs/gpio.rst --- python-periphery-2.0.0/docs/gpio.rst 2019-10-29 03:46:27.000000000 +0000 +++ python-periphery-2.0.1/docs/gpio.rst 2020-01-08 06:41:59.000000000 +0000 @@ -8,9 +8,9 @@ from periphery import GPIO - # Open GPIO /dev/gpiochip0 10 with input direction + # Open GPIO /dev/gpiochip0 line 10 with input direction gpio_in = GPIO("/dev/gpiochip0", 10, "in") - # Open GPIO /dev/gpiochip0 12 with output direction + # Open GPIO /dev/gpiochip0 line 12 with output direction gpio_out = GPIO("/dev/gpiochip0", 12, "out") value = gpio_in.read() diff -Nru python-periphery-2.0.0/periphery/__init__.py python-periphery-2.0.1/periphery/__init__.py --- python-periphery-2.0.0/periphery/__init__.py 2019-10-29 03:46:27.000000000 +0000 +++ python-periphery-2.0.1/periphery/__init__.py 2020-01-08 06:41:59.000000000 +0000 @@ -1,9 +1,9 @@ import time -__version__ = "2.0.0" +__version__ = "2.0.1" "Module version string." -version = (2, 0, 0) +version = (2, 0, 1) "Module version tuple." diff -Nru python-periphery-2.0.0/periphery/pwm.py python-periphery-2.0.1/periphery/pwm.py --- python-periphery-2.0.0/periphery/pwm.py 2019-10-29 03:46:27.000000000 +0000 +++ python-periphery-2.0.1/periphery/pwm.py 2020-01-08 06:41:59.000000000 +0000 @@ -1,3 +1,4 @@ +import errno import os import time @@ -78,6 +79,18 @@ if not exported: raise TimeoutError("Exporting PWM: waiting for \"{:s}\" timed out".format(channel_path)) + # Loop until period is writable. This could take some time after + # export as application of udev rules after export is asynchronous. + for i in range(PWM.PWM_STAT_RETRIES): + try: + with open(os.path.join(channel_path, "period"), 'w'): + break + except IOError as e: + if e.errno != errno.EACCES or (e.errno == errno.EACCES and i == PWM.PWM_STAT_RETRIES - 1): + raise PWMError(e.errno, "Opening PWM period: " + e.strerror) + + time.sleep(PWM.PWM_STAT_DELAY) + self._chip = chip self._channel = channel self._path = channel_path diff -Nru python-periphery-2.0.0/README.md python-periphery-2.0.1/README.md --- python-periphery-2.0.0/README.md 2019-10-29 03:46:27.000000000 +0000 +++ python-periphery-2.0.1/README.md 2020-01-08 06:41:59.000000000 +0000 @@ -1,4 +1,4 @@ -# python-periphery [![Build Status](https://travis-ci.org/vsergeev/python-periphery.svg?branch=master)](https://travis-ci.org/vsergeev/python-periphery) [![GitHub release](https://img.shields.io/github/release/vsergeev/python-periphery.svg?maxAge=7200)](https://github.com/vsergeev/python-periphery) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/vsergeev/python-periphery/blob/master/LICENSE) +# python-periphery [![Build Status](https://travis-ci.org/vsergeev/python-periphery.svg?branch=master)](https://travis-ci.org/vsergeev/python-periphery) [![Docs Status](https://readthedocs.org/projects/python-periphery/badge/)](https://python-periphery.readthedocs.io/en/latest/) [![GitHub release](https://img.shields.io/github/release/vsergeev/python-periphery.svg?maxAge=7200)](https://github.com/vsergeev/python-periphery) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/vsergeev/python-periphery/blob/master/LICENSE) ## Linux Peripheral I/O (GPIO, LED, PWM, SPI, I2C, MMIO, Serial) with Python 2 & 3 @@ -32,9 +32,9 @@ ``` python from periphery import GPIO -# Open GPIO /dev/gpiochip0 10 with input direction +# Open GPIO /dev/gpiochip0 line 10 with input direction gpio_in = GPIO("/dev/gpiochip0", 10, "in") -# Open GPIO /dev/gpiochip0 12 with output direction +# Open GPIO /dev/gpiochip0 line 12 with output direction gpio_out = GPIO("/dev/gpiochip0", 12, "out") value = gpio_in.read() diff -Nru python-periphery-2.0.0/setup.py python-periphery-2.0.1/setup.py --- python-periphery-2.0.0/setup.py 2019-10-29 03:46:27.000000000 +0000 +++ python-periphery-2.0.1/setup.py 2020-01-08 06:41:59.000000000 +0000 @@ -5,7 +5,7 @@ setup( name='python-periphery', - version='2.0.0', + version='2.0.1', description='A pure Python 2/3 library for peripheral I/O (GPIO, LED, PWM, SPI, I2C, MMIO, Serial) in Linux.', author='vsergeev', author_email='v@sergeev.io', diff -Nru python-periphery-2.0.0/tests/test_led.py python-periphery-2.0.1/tests/test_led.py --- python-periphery-2.0.0/tests/test_led.py 2019-10-29 03:46:27.000000000 +0000 +++ python-periphery-2.0.1/tests/test_led.py 2020-01-08 06:41:59.000000000 +0000 @@ -35,6 +35,16 @@ assert led.fd > 0 assert led.max_brightness > 0 + # Set brightness to True, check brightness + led.write(True) + time.sleep(0.01) + assert led.read() == led.max_brightness + + # Set brightness to False, check brightness + led.write(False) + time.sleep(0.01) + assert led.read() == 0 + # Set brightness to 1, check brightness led.write(1) time.sleep(0.01) @@ -55,16 +65,6 @@ time.sleep(0.01) assert led.brightness == 0 - # Set brightness to True, check brightness - led.write(True) - time.sleep(0.01) - assert led.read() == led.max_brightness - - # Set brightness to False, check brightness - led.write(False) - time.sleep(0.01) - assert led.read() == 0 - led.close() print("Open/close test passed.") diff -Nru python-periphery-2.0.0/tests/test_pwm.py python-periphery-2.0.1/tests/test_pwm.py --- python-periphery-2.0.0/tests/test_pwm.py 2019-10-29 03:46:27.000000000 +0000 +++ python-periphery-2.0.1/tests/test_pwm.py 2020-01-08 06:41:59.000000000 +0000 @@ -38,7 +38,8 @@ assert pwm.chip == pwm_chip assert pwm.channel == pwm_channel - # Initialize duty cycle to 0 + # Initialize period and duty cycle + pwm.period = 5e-3 pwm.duty_cycle = 0 # Set period, check period, check period_ns, check frequency