Skip to content

Commit

Permalink
added logging to inform user of 1s retry if set_direction fails on th…
Browse files Browse the repository at this point in the history
…e first try, updating to v0.7.1
  • Loading branch information
xtacocorex committed Nov 12, 2017
1 parent 906beb0 commit 84df437
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 15 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
0.7.1
---
* Merged in PR #79
* Merged in PR #80
* Added message notifying user of the gpio set direction retry

0.7.0
---
* Added ability to specify GPIO only as a number, this doesn't work for PWM/SPWM/LRADC/SERVO
Expand Down
29 changes: 18 additions & 11 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,36 +1,43 @@
chip-io (0.7.1-1) unstable; urgency=low

* Merged PR#79 and#80
* Added logging to tell user of the 1 second sleep before retry on setting gpio direction

-- Robert Wolterman <[email protected]> Sun, 12 Nov 2017 07:40:00 -0600

chip-io (0.7.0-1) unstable; urgency=low

* Added ability to specify GPIO only as a number, this doesn't work for PWM/SPWM/LRADC/SERVO
* Added ability to specify GPIO only as a number, this doesn't work for PWM/SPWM/LRADC/SERVO

-- Robert Wolterman <[email protected]> Wed, 13 Sep 2017 09:51:00 -0600

chip-io (0.6.2-1) unstable; urgency=low

* Implementation for number 77 ability to push up binary pypi
* Implementation for number 75 wait for edge timeout
* Implementation for number 77 ability to push up binary pypi
* Implementation for number 75 wait for edge timeout

-- Robert Wolterman <[email protected]> Sun, 03 Sep 2017 21:34:00 -0600

chip-io (0.6.1-1) unstable; urgency=low

* Fixing implementation for #76
* Fixing implementation for #76

-- Robert Wolterman <[email protected]> Wed, 09 Aug 2017 23:09:00 -0600

chip-io (0.6.0-1) unstable; urgency=low

* Random comment cleanup
* Implement fix for #76
* API documentation added
* Closing #74
* Random comment cleanup
* Implement fix for #76
* API documentation added
* Closing #74

-- Robert Wolterman <[email protected]> Wed, 09 Aug 2017 22:50:00 -0600

chip-io (0.5.9-1) unstable; urgency=low

* Merged PR#70 to enable the underlying C code to be used properly in C based code
* Updated README to add missing pins on the CHIP Pro that are available as GPIO
* Updated README to denote pins that are available for Edge Detection
* Merged PR#70 to enable the underlying C code to be used properly in C based code
* Updated README to add missing pins on the CHIP Pro that are available as GPIO
* Updated README to denote pins that are available for Edge Detection

-- Robert Wolterman <[email protected]> Tue, 08 Jun 2017 20:03:00 -0600

Expand Down
4 changes: 2 additions & 2 deletions debian/files
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
python-chip-io_0.7.0-1_armhf.deb python optional
python3-chip-io_0.7.0-1_armhf.deb python optional
python-chip-io_0.7.1-1_armhf.deb python optional
python3-chip-io_0.7.1-1_armhf.deb python optional
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
'Topic :: System :: Hardware']

setup(name = 'CHIP_IO',
version = '0.7.0',
version = '0.7.1',
author = 'Robert Wolterman',
author_email = '[email protected]',
description = 'A module to control CHIP IO channels',
Expand Down
2 changes: 1 addition & 1 deletion source/constants.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,6 @@ void define_constants(PyObject *module)
bcm = Py_BuildValue("i", BCM);
PyModule_AddObject(module, "BCM", bcm);

version = Py_BuildValue("s", "0.7");
version = Py_BuildValue("s", "0.7.1");
PyModule_AddObject(module, "VERSION", version);
}
5 changes: 5 additions & 0 deletions source/event_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,10 +385,15 @@ int gpio_set_direction(int gpio, unsigned int in_flag)
snprintf(filename, sizeof(filename), "/sys/class/gpio/gpio%d/direction", gpio); BUF2SMALL(filename);

if ((fd = open(filename, O_WRONLY)) < 0) {
// NOTIFY THAT WE'RE GOING TO SLEEP AND RETRY
char err[256];
snprintf(err, sizeof(err), "gpio_set_direction: could not open '%s', sleeping for 1 second and retrying", filename);
add_error_msg(err);
// if called as non-root, udev may need time to adjust file
// permissions after setting up gpio
sleep(1);

// TRY AGAIN AND IF THIS TIME FAILS, KICK OUT
if ((fd = open(filename, O_WRONLY)) < 0) {
char err[256];
snprintf(err, sizeof(err), "gpio_set_direction: could not open '%s' (%s)", filename, strerror(errno));
Expand Down

0 comments on commit 84df437

Please sign in to comment.