Repository navigation
linux-fs not found #330
Replies: 15 comments 26 replies
|
Just to do an end-to-end check I changed "linuxfs-i2c" to pigpio-i2c and it found pigpio-i2c but got an IllegalStateException trying to do a writeRegister(). so I must have the path correct and I assume "linuxfs-i2c" is correct since I copied it from the EEPROM example.. What's different between pigpio-i2c and linuxfs-i2c that prevents the latter from being found. I see "linuxfs-i2c" in LinuxFsI2CProvider.class so spelling must be correct. I'm using pi4j 2.5 SNAPSHOT.. I tried replacing pi4j-core.jar with pi4j-core-2.1.1 from the download but got a bunch of "cant find" symbol errors. I could really use some thoughts on this. |
|
I don't know your development environment. When I build my devices with maven these jars are placed into target/distribution |
|
Been fiddling around and I got rid of the exception for the time being. Following the Adafruit C code example I was reading 8 bytes from the device. I chanted it to 4 bytes and the exception went away. Still not getting cprrect values back though. Thanks for the help from all. Think I'll close this for now.. |
|
Does your code read some smaller number of bytes and then try 8, hitting the bug. By reading 1 byte then 8 I was able to duplicate what you encountered. Initially and always 8 worked. I did a pull-request of a fix for this. If approved I will let you know when/how available, but sounds like you may not want it right away if you are making progress around the exception. |
|
Yes, all the reads are 4 bytes except this 8 bytes. The. Adafruit has an 8 byte collection of “pseudo” digital pins one of which flags the encoder push button.
|
|
I'm progressing but now I get: using: this code was working at one point today. |
|
|
https://pi4j.com/download/ [pi4j-2.5.0-SNAPSHOT.zip (2.36 MiB, 2024-03-03 07:18)] This build contains the fix for the error when you read from the I2C chip 4 bytes and then read 8 bytes. Scratch buffer overrun |
|
Is there any documentation/source for linuxfs? All I have is what Netbeans provides when it decompiles the library methods. Also Netbeans doesn't seem to recognize a offset parameter method call in the read/write bytes methods. Without the offset it shows the parameter names for the method declaration parameters in light text but with offset it just shows "arg1, arg2" etc. I could really use either source of method calls for the linuxfs code that is available for my use. |
|
I created PullRequest 333 an hour ago. Fixes two other linuxfs methods that are read from a specific register. U can hunt this up in the pi4j code repository for details This change does not include the method in the call stack you sent yesterday. Docs. There is no design doc specific to linuxfs. The couple of linuxfs java files in your call stack are the ones involved in runtime. The pi4j web site snapshot downloads should have a jar of source code. Next i was going to further investigate the exception in yesterday's call stack. It is the most simple code of the various methods, odd it has this intermittent exception |
|
pi4j-2.5.0-SNAPSHOT.zip (2.36 MiB, 2024-03-10 15:23) That is the most recent linuxfs updates. These are Pigpio compatibility updates that may not effect you. However I was able to create your ioexception. Assuming your first linuxfs call is the one using a two byte register address. As an experiment can you place the simple linuxfs read() operation as your first linuxfs access. Please let me know if that stops the ioexceptions ? |
|
Not certain which encoder you are using, I obtained an adafruit I2C QT Rotary Encoder. Maybe the same and it can help. |
|
I gave up on adafruit.. I used some eeprom code as a starting point. It required Linux-fs which is in the pi4j distribution. I gave up and now use sparkfun device. I’ve not seen the attached code. Maybe I’ll go back and try it. Thanks ---------------------------------Ronald T. ***@***.*** NHOn Aug 27, 2024, at 6:57 PM, Tom Aarts ***@***.***> wrote:
Not certain which encoder you are using, I obtained an adafruit I2C QT Rotary Encoder. Maybe the same and it can help.
It arrived and I coded up support using the adafruit python as docs, since this HW company won't release specs on the firmware they have running on the chip.
https://github.com/Pi4J/pi4j-example-devices/blob/master/src/main/java/com/pi4j/devices/rotary_encoder/RotaryEncoderId5880I2C.java
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you modified the open/close state.Message ID: ***@***.***>
|
|
I found way to fix it you just need to build own context with this provider final var pi4jBuilder = Pi4J.newContextBuilder();
pi4jBuilder.add(new LinuxFsI2CProviderImpl());
final Context pi4j = pi4jBuilder.build();
``` |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
My app requires 16 bit i2c register addresses.. I've extracted/tweaked the linus-fs code I need from AT24C512.java compiled and built.. when I run it, the linux-fs provider can't be found. I've put the necessary files where I have the rest of the pi4j files. I'm missing something.
Exception in thread "main" com.pi4j.provider.exception.ProviderNotFoundException: Pi4J provider [linuxfs-i2c] could not be found. Please include this 'provider' JAR in the classpath. at com.pi4j.provider.impl.DefaultRuntimeProviders.get(DefaultRuntimeProviders.java:227) at com.pi4j.provider.impl.DefaultProviders.get(DefaultProviders.java:147) at com.pi4j.provider.Providers.get(Providers.java:253) at com.pi4j.context.Context.create(Context.java:327) at com.pi4j.internal.IOCreator.create(IOCreator.java:58) at com.pi4j.internal.IOCreator.create(IOCreator.java:126) at raspberrypi.I2C_fs.<init>(I2C_fs.java:77) at QWIK.RotaryEncoder.<init>(RotaryEncoder.java:56)The CLASSPATH/ library path (CLASSPATH=:/home/pi/NetBeansProjects/Tune/dist/lib) contains
libpi4j-linuxfs.so pi4j-core.jar pi4j-library-pigpio.jar pi4j-plugin-raspberrypi.jar Utilities.jar log4j-api-2.20.0.jar pi4j-library-linuxfs-2.1.1.jar pi4j-plugin-linuxfs-2.1.1.jar RaspberryPi.jar log4j-core-2.20.0.jar pi4j-library-pigpio-armhf.so pi4j-plugin-pigpio.jar slf4j-api-2.0.9.jarCONSTRUCTOR CODE:
` public I2C_(int nAddr)
{
_pi4j = Pi4J.newAutoContext();
_nAddr = nAddr;
WHAT AM I MISSING
All reactions