New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BBB, error closing device #27
Comments
Hi, sorry for the delay replying. Could you try run this without the diozero-provider-jdkdio11-0.11-SNAPSHOT.jar and dio-1.1-dev-linux-armv6hf.jar JAR files on the classpath. Regards, |
I get this same error without the jar on the classpath See command and output below java -classpath tinylog-1.2.jar:diozero-core-0.11-SNAPSHOT.jar:diozero-sampleapps-0.11-SNAPSHOT.jar com.diozero.sampleapps.ButtonTest 66 14:30:05.748 [main] DEBUG com.diozero.util.DeviceFactoryHelper.init - Using native device factory class SysFsDeviceFactory |
Turns out this has to do with cape universal being enabled in more recent images. It exports all of the GPIOs and does not allow you to unexport them. Similar issue fivdi/onoff#50
|
Thanks for investigating. I will add that change and push a new snapshot build ASAP. |
Running on BBB, testing GPIO 67 getting the following after main part executes
java -cp lib/tinylog-1.2.jar:lib/diozero-core-0.11-SNAPSHOT.jar:lib/diozero-sampleapps-0.11-SNAPSHOT.jar:lib/diozero-provider-jdkdio11-0.11-SNAPSHOT.jar:lib/dio-1.1-dev-linux-armv6hf.jar com.diozero.sampleapps.LEDTest 67
03:41:10.993 [main] DEBUG com.diozero.util.DeviceFactoryHelper.init - Using native device factory class SysFsDeviceFactory
03:41:11.309 [main] DEBUG com.diozero.internal.provider.sysfs.SysFsDeviceFactory.export - export(67, DIGITAL_OUTPUT)
03:41:11.370 [main] INFO com.diozero.sampleapps.LEDTest.test - On
03:41:11.589 [main] DEBUG com.diozero.util.LibraryLoader.loadLibrary - Loaded library 'diozero-system-utils' from classpath
03:41:12.617 [main] INFO com.diozero.sampleapps.LEDTest.test - Off
03:41:13.626 [main] INFO com.diozero.sampleapps.LEDTest.test - Toggle
03:41:14.634 [main] INFO com.diozero.sampleapps.LEDTest.test - Toggle
03:41:15.641 [main] INFO com.diozero.sampleapps.LEDTest.test - Blink 10 times
03:41:25.657 [main] INFO com.diozero.sampleapps.LEDTest.test - Done
03:41:25.665 [main] DEBUG com.diozero.api.DigitalOutputDevice.close - close()
03:41:25.669 [main] DEBUG com.diozero.internal.provider.AbstractDevice.close - close(), key=Native-GPIO-67
03:41:25.676 [main] DEBUG com.diozero.internal.provider.sysfs.SysFsDigitalOutputDevice.closeDevice - closeDevice()
03:41:25.689 [main] ERROR com.diozero.internal.provider.AbstractDevice.close - Error closing device Native-GPIO-67: com.diozero.util.RuntimeIOException: java.io.IOException: Invalid argument: com.diozero.util.RuntimeIOException: java.io.IOException: Invalid argument
at com.diozero.internal.provider.sysfs.SysFsDeviceFactory.unexport(SysFsDeviceFactory.java:225)
at com.diozero.internal.provider.sysfs.SysFsDigitalOutputDevice.closeDevice(SysFsDigitalOutputDevice.java:111)
at com.diozero.internal.provider.AbstractDevice.close(AbstractDevice.java:66)
at com.diozero.api.DigitalOutputDevice.close(DigitalOutputDevice.java:102)
at com.diozero.sampleapps.LEDTest.test(LEDTest.java:90)
at com.diozero.sampleapps.LEDTest.main(LEDTest.java:68)
Caused by: java.io.IOException: Invalid argument
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:326)
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
at sun.nio.cs.StreamEncoder.implClose(StreamEncoder.java:316)
at sun.nio.cs.StreamEncoder.close(StreamEncoder.java:149)
at java.io.OutputStreamWriter.close(OutputStreamWriter.java:233)
at com.diozero.internal.provider.sysfs.SysFsDeviceFactory.unexport(SysFsDeviceFactory.java:224)
at com.diozero.internal.provider.sysfs.SysFsDigitalOutputDevice.closeDevice(SysFsDigitalOutputDevice.java:111)
at com.diozero.internal.provider.AbstractDevice.close(AbstractDevice.java:66)
at com.diozero.api.DigitalOutputDevice.close(DigitalOutputDevice.java:102)
at com.diozero.sampleapps.LEDTest.test(LEDTest.java:90)
at com.diozero.sampleapps.LEDTest.main(LEDTest.java:68)
03:41:25.712 [main] DEBUG com.diozero.internal.DeviceStates.closed - closed(Native-GPIO-67)
03:41:25.812 [main] DEBUG com.diozero.internal.provider.AbstractDeviceFactory.close - close()
03:41:25.821 [main] DEBUG com.diozero.internal.DeviceStates.closeAll - closeAll()
03:41:25.879 [DIO-Zero Shutdown Handler] DEBUG com.diozero.util.ShutdownHandlerThread.run - Shutdown handler running
03:41:25.888 [DIO-Zero Shutdown Handler] DEBUG com.diozero.internal.provider.AbstractDeviceFactory.close - close()
03:41:25.893 [DIO-Zero Shutdown Handler] DEBUG com.diozero.internal.DeviceStates.closeAll - closeAll()
03:41:25.895 [DIO-Zero Shutdown Handler] DEBUG com.diozero.util.ShutdownHandlerThread.run - Shutdown handler finished
The text was updated successfully, but these errors were encountered: