Skip to content

Commit

Permalink
Fixed GpioD initialisation
Browse files Browse the repository at this point in the history
  • Loading branch information
alex9849 committed Feb 22, 2024
1 parent b5603db commit 6aac9d0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 664 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -367,17 +367,6 @@ static Long chipIterNextNoClose(long chipIterPtr) {

private static native Long c_gpiod_chip_iter_next_noclose(long chipIterPtr);

static long lineIterNew(long chipPtr) {
Long ptr = gpiod_line_iter_new(chipPtr);
if (ptr == null)
throw new GpioDException("gpiod_line_iter_new failed!");
return ptr;
}

private static native Long gpiod_line_iter_new(long chipPtr);

private static native Long gpiod_line_iter_next(long lineIterPtr);

static long lineEventGetTimespec(long lineEventPtr) {
return c_gpiod_line_event_get_timespec(lineEventPtr);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ public synchronized void initialize() {
break;
}
} finally {
GpioD.chipIterFree(chipIterPtr);
if (found != null) {
GpioD.chipIterFreeNoClose(chipIterPtr);
} else {
GpioD.chipIterFree(chipIterPtr);
}
}

if (found == null)
Expand Down
Loading

0 comments on commit 6aac9d0

Please sign in to comment.