Skip to content

Commit 84df437

Browse files
committed
added logging to inform user of 1s retry if set_direction fails on the first try, updating to v0.7.1
1 parent 906beb0 commit 84df437

File tree

6 files changed

+33
-15
lines changed

6 files changed

+33
-15
lines changed

CHANGELOG.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
0.7.1
2+
---
3+
* Merged in PR #79
4+
* Merged in PR #80
5+
* Added message notifying user of the gpio set direction retry
6+
17
0.7.0
28
---
39
* Added ability to specify GPIO only as a number, this doesn't work for PWM/SPWM/LRADC/SERVO

debian/changelog

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,43 @@
1+
chip-io (0.7.1-1) unstable; urgency=low
2+
3+
* Merged PR#79 and#80
4+
* Added logging to tell user of the 1 second sleep before retry on setting gpio direction
5+
6+
-- Robert Wolterman <[email protected]> Sun, 12 Nov 2017 07:40:00 -0600
7+
18
chip-io (0.7.0-1) unstable; urgency=low
29

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

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

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

9-
* Implementation for number 77 ability to push up binary pypi
10-
* Implementation for number 75 wait for edge timeout
16+
* Implementation for number 77 ability to push up binary pypi
17+
* Implementation for number 75 wait for edge timeout
1118

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

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

16-
* Fixing implementation for #76
23+
* Fixing implementation for #76
1724

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

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

22-
* Random comment cleanup
23-
* Implement fix for #76
24-
* API documentation added
25-
* Closing #74
29+
* Random comment cleanup
30+
* Implement fix for #76
31+
* API documentation added
32+
* Closing #74
2633

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

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

31-
* Merged PR#70 to enable the underlying C code to be used properly in C based code
32-
* Updated README to add missing pins on the CHIP Pro that are available as GPIO
33-
* Updated README to denote pins that are available for Edge Detection
38+
* Merged PR#70 to enable the underlying C code to be used properly in C based code
39+
* Updated README to add missing pins on the CHIP Pro that are available as GPIO
40+
* Updated README to denote pins that are available for Edge Detection
3441

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

debian/files

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
python-chip-io_0.7.0-1_armhf.deb python optional
2-
python3-chip-io_0.7.0-1_armhf.deb python optional
1+
python-chip-io_0.7.1-1_armhf.deb python optional
2+
python3-chip-io_0.7.1-1_armhf.deb python optional

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
'Topic :: System :: Hardware']
1414

1515
setup(name = 'CHIP_IO',
16-
version = '0.7.0',
16+
version = '0.7.1',
1717
author = 'Robert Wolterman',
1818
author_email = '[email protected]',
1919
description = 'A module to control CHIP IO channels',

source/constants.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,6 @@ void define_constants(PyObject *module)
8585
bcm = Py_BuildValue("i", BCM);
8686
PyModule_AddObject(module, "BCM", bcm);
8787

88-
version = Py_BuildValue("s", "0.7");
88+
version = Py_BuildValue("s", "0.7.1");
8989
PyModule_AddObject(module, "VERSION", version);
9090
}

source/event_gpio.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,10 +385,15 @@ int gpio_set_direction(int gpio, unsigned int in_flag)
385385
snprintf(filename, sizeof(filename), "/sys/class/gpio/gpio%d/direction", gpio); BUF2SMALL(filename);
386386

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

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

0 commit comments

Comments
 (0)