-
Notifications
You must be signed in to change notification settings - Fork 25
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
Support for 32 bit Raspberry Pi OS #29
Comments
What OS are you using? |
Sorry for the delay in response... I am running Raspbian Linux 11 bullseye the 32bit version\ |
Because It is also possible that the native C code doesn't work on Raspbian Linux - I tested it only on Ubuntu. Can you try testing with this code:
You can also try:
Try it with all USB devices you have - all USB flash drives, external hard drives, any keyboard, mouse, webcam, printer, joypad, ... |
So i tried keyboard, mouse, pico, and usb drive.....nothing triggered an event. I believe Raspbian is based on the debian linux os but optimized for raspberry pi. besides switching operating systems do you have any other ideas? i know its asking ALOT but any chance you can test it on debian? |
A few other ideas - make sure you have gcc
I will try to test it in Debian or, even better, on Raspbian for PC: I hope that the reason is not that the native C code works on Intel, but not on ARM. |
I tried it with Raspberry Pi OS and I found the reason: I somehow forgot that, because I started the project a long time ago Can you try with 64 bit Raspberry Pi OS? |
Thank you for the update. I migrated my pi to 64bit and could NOT get it to work. no usb devices are recognized. I went back my 32 bit version of the OS and that also did not work. I was using version 11.0.0.0 I compiled for AnyCPU and .net 7. I published it for linux-arm (and linux-arm64 when i was using the 64 bit OS) I was running the code you suggested I run. any more thoughts? |
That is my fault - I was focused on making it for 32 bit and I forgot on ARM. At first I compiled the native C code with:
Now I added:
And I thought that solved the problem. Of course, to solve the problem for ARM, I will have to add:
I will do this as soon as I find the time to do it, perhaps today... If you want to try it yourself, just add the gcc commands here: https://github.com/Jinjinov/Usb.Events/blob/master/Usb.Events/Usb.Events.csproj#L54 you will need:
and add the package to the right folder:
here: https://github.com/Jinjinov/Usb.Events/blob/master/Usb.Events/Usb.Events.csproj#L66 |
I have somewhat bad news - installing ARM versions of
clashes with the package that enables to compile for 32 bit Intel on 64 bit Intel
That means the csproj file can not simultaneously include instructions to compile for ARM and Intel, which would be ideal. Even worse news:
returns:
It has something to do with the fact that ARM packages are not available on Intel platforms by default. Right now I can think of only 3 solutions:
|
ChatGPT hallucinations led me down the wrong path, wasting A LOT of my time. What I wrote in the previous comment is not all true. I will try to find a solution for this. EDIT: it is unbelievable how confident ChatGPT, Bing AI and Bard AI are when misleading you about compiling for ARM on Intel. All three consistently give wrong information. They all suggest cross-compilation, but that works only if you don't need the libudev for ARM - once you hit that wall, they keep you running in circles. I finally got 3 options that will probably work:
I will probably try Docker first, sounds promising. |
This was the hardest issue so far, but I learned a lot! :) I hope it works, I have no way to test it. https://github.com/Jinjinov/Usb.Events/releases/tag/v11.0.0.1 |
Sorry for the delayed response....work has been crazy. I missed the ChatGPT comment until today....I chuckled and simultaneously felt bad for you and appreciative of your efforts. You mentioned that what you said in the previous comment was not correct - i am not sure what part was not correct and I dont understand how using a Container (docker) could resolved the issue. When i tested 11.0.0.1, i was not able to get it to work, I tried on 32 and 64 bit Pi OS. Is there something I can do, you had mentioned compiling on the Pi (maybe that was the "wrong" part of your comment??) |
There was a flood of my comments in this thread, I deleted most of them and truncated others... It still doesn't work, huh... there is not much more I can do, but perhaps you can help - instructions at the end, you can skip there if details don't interest you. To explain all the changes since the start of this issue - most of them are in the Usb.Events.csproj The problem: we need to compile
The new NuGet has all these versions of
I tested only TL;DR:What you could do is relatively simple, but it would help a lot:
You could also do a binary compare of your |
I got the c library compiled on raspberry pi 64 bit using this link: https://stackoverflow.com/questions/14884126/build-so-file-from-c-file-using-gcc-command-line When I ran main.c, it seemed to be working as expected (see screen shot) However, when i tried to build the C# code i got errors about gcc and -m32: I am not sure how to resolve.....this seems to be coming from the project file from line 59 with Command="gcc -m32..." it almost like it is tryingto build for x86 even though i am on an ARM??? any thoughts? |
I am glad that you were able to run main.c and that it works! :) You don't have to build from the terminal, the file that runs the gcc is the Makefile: The problem with I changed the Usb.Events.csproj to check for architecture before running the gcc, so it should work now. |
I tried a couple different things but could not get it to work. This is what I did but i feel like I am screwing something up.
Like i said, i feel like i am screwing something up but dont know where to go. Much of this work is not what i am used to (Linux, c, VSCode for C#, etc...) |
Thank you for trying! I know there is a lot involved, especially for someone who is not used to all these technologies :) If you carefully follow all these instructions, it should work: Install these: Don't run or at least use the Makefile where all the parameters are already defined. Copy the
Be careful, one is Then open |
I confirmed i had the 4 correct vscode tools. I opened the linux folder, selected the makefile, clicked Terminal->Run Build Task. I was prompted with a tool selection -> Build or Build Debug. I selected Build Debug but only got a UsbEventWatcher.Linux.o file was created in the Usb.Events/Usb.Events/Linux/obj directory. Is there something i should be doing to get the .so file or looking in a different place? |
That is my fault again. I forgot that my script works only on Intel, not on ARM. There are so many different places in the build process where I never considered ARM, and I can't test it all because I don't have an ARM. I'm on vacation this week, I will take a look when I get back home. |
Did you use the If you don't use |
sorry to keep coming back.....i only get time intermittently to work on this...i found an issue in the csproj for compiling against arm64....around line 121 it says exec condition isOsPlatform = linux and IsArm = true but it is missing the longbit check.....because on 64 bit it tries to use -march=armv7-a+fp which i think is incorrect.....maybe i am wrong but when i put hte longbit check in, the buld correctly selected the msbuild cmd on line 129 i guess the commands could also just be reordered but that seems hacky |
Could you use the latest version? I think that the line numbers don't match. This line compiles to This line compiles to Did you try what I suggested the last time?
I think you were really close to making it work, because I can see I also wrote more information in the Readme: https://github.com/Jinjinov/Usb.Events#how-to-build |
you are correct the line numbers dont match, earlier i had added a couple log statements that messed up the line numbers. however we are talking about the same line numbers and the command on line 118 was giving me the error. when i added the LongBit check the build correctly choose the path of your second reference and successfully built with line 126. I then built the Test project and everything seems to be working as expected. HOORAY!!! I will now test it with my code. THANK YOU for your guidance and help!!!! |
I am glad that you made it work! :) Can you please tell me about your exact setup you are using now? If there are any mistakes in the When using Intel, I was using the same logic for ARM, but I can't test it because I don't have an ARM. Can you try adding |
Thank you for the library....i was using it on Windows and it is very nice....easy to use and works as expected. Much appreciated.
I am wanting to use it on a Raspberry Pi, compiling the test project with .Net 6 (I see that the project is compatible with .Net Core 2 and higher) but when i execute the test program, i find no usb devices. I have a mouse, keyboard, and a Raspberry Pico plugged in. Here is my test project.....
I cant figure out what i am missing....any ideas?
Thanks
The text was updated successfully, but these errors were encountered: