Why is libgpiod is corrupting my filesystem? - filesystems

I have an OpenWRT system (Intel) where I have to control some GPIOS (it87). I would like to update from the classic sysfs approach (which works fine, but is being deprecated) to the new chardev, using libgpiod.
However, when I use the gpiod-tools (gpioget for instance), after a while using it, random files with random names (but all of them look like output console sentences) starts to create on / directory. Let me show you an example (this is after 1 hour uptime, only blue folders should be there)
This happens with OpenWRT 21 & 22, and with kernel 5.4 & 5.10.154. I really don't know why it is happening.
I tried tweaking some kernel paremeters regarding GPIO, my current cfg is as follows:
I tried also enabling both (sysfs & chardev), no luck.
What I'm missing? Could be something in other kernel cfg section?
Thank you! Any help would be really appreciated!

Related

How to get display devices name in Linux

I'd like to find linux analogs of EnumDisplayDevices and EnumDisplaySettingsEx WinAPI functions.
The info I need to get is display name and state (if it active or not), width, height, bits per pixel and frequency.
How can I get this info using C (C++)?
Thanks.
As mentioned by 'Some programmer dude' in the comments you can have to go through the X window system. Most specifically one option would be the RandR protocol. Here is the protocol specification as well as the source code of the command xrandr that invokes the XRR functions and outputs most of the info that you want on the terminal. Look for the place where the
XRRScreenResources *res
is populated and then how the modes are fetched from it using the find_mode() function.
other commands that might assist you and don't go over the RandR extensions could be xprop(1), xdpyinfo(1), xwininfo(1)
Some programmer dude and ramrunner are absolutely correct. For most Linux systems, the graphical "desktop" is based on X Windows. Command-line tools for querying your X "display" include xrandr and xdpyinfo. The C-language source code for both are freely available; you can find many example programs with a Google search.
... HOWEVER ...
X Windows is "client/server". Your Linux "desktop" need not be on your physical PC; your X "display" could just as easily be a Windows desktop. In this case - xrandr and xdpyinfo are still applicable: they refer to where you're displaying (e.g. an XMing client on Windows), and not the physical host Linux is running on.
If you want to query the graphics devicews on your physical server ... then you'll instead use commands like lshw -c display or get-edid

problems while importing freeRTOS to AT32UC3A0512

i am attempting to integrate freeRTOS to my application that run on AT32UC3A0512.
I downloaded a freeRTOS project example for EVK1100 (it Supports the AT32UC3A) and try to include the kernel source file
so my application hierarchy looks like :
src
|ASF
|APP_FOLDER
|freertos
|freertos-7.0.0
this hierarchy is different than the the hierarchy provided in the freeRTOS project example which looks like
src
|ASF
|thirdparty
|freertos
|freertos-7.0.0 /********** freertos-7.0.0 is under ASF***********/
1 - This has caused compilation problems(path of some file not recognized) that i have solved, and i don't think that it can lead to other issues. what do you think?
now it seems also that i have problems with exception.s
/*my actual appli hierarchy*/
src
|ASF
|AVR32
|intc
|exception.s
|APP_FOLDER
|freertos
|freertos-7.0.0
|source
|portable
|gcc
|avr32_uc3
|exception.S
As you see the file is redefined,i came to this solution that consist in removing exception.s under intc folder, now the project compiles but there is calls to twi_master_read in my application that cause blocking, i haven't changed anything in my application(which use to work normally) i didn't call any freeRTOS api function yet,
2- could you please help me undrestand the the purpose of exception.s, and what leaded to this unexpected behaviour ?
3- Could this problem come from the non respect of the hierarchy ?
Don't hesitate to comment on my choices or suggest better practices on importing freeRTOS kernel ?
Thanks in advance.
EDIT
I removed exception.s from freertos-7.0.0/source/portable/gcc/avr32_uc3/exception.S and keep the exception.s file of my starting application, Now using the application hierarchy mentioned above if i exclude freertos directory from the project all works well, if i include the freertos directory twi_master_read causes problems, There is any pins redefinitions in the kernel files and i didn't call/include freeRTOS API at all so how the behaviour changes this way ?

"Expected a field name" error in Keil uVision 4 (error#134)

I've been developing an embedded project for NXP LPC1774 Arm CortexM3 MCU.For the same project, I have coded many different versions and all worked fine. Today I added two new pin definitions where I choose them to be output pins for GPIO ports with the following line:
LPC_GPIO4->DIR |= 0x2000;
after this, I started to get the error #134 in every single line where I call a DIR register. I realized some header calls refer to another copy of the same file and I changed it. It did not help. Does anyone have an idea where this error could come from?
I finally solved the problem.
In my definitions file, I had a definition for motor direction and named it as DIR. It confused the compiler due to double definition.

How do I trace coreutils down to a syscall?

I am trying to navigate and understand whoami (and other coreutils) all the way down to the lowest level source code, just as an exercise.
My dive so far:
Where is the actual binary?
which whoami
/usr/bin/whoami
Where is it maintained?
http://www.gnu.org/software/coreutils/coreutils.html
How do I get source?
git clone git://git.sv.gnu.org/coreutils
Where is whoami source code within the repository?
# find . | grep whoami
./man/whoami.x
./man/whoami.1
./src/whoami.c
./src/whoami
./src/whoami.o
./src/.deps/src_libsinglebin_whoami_a-whoami.Po
./src/.deps/whoami.Po
relevant line (84):
uid = geteuid ();
This is approximately where my rabbit hole stops. geteuid() is mentioned in gnulib/lib/euidaccess.c, but not explicitly defined AFAICT. It's also referenced in /usr/local/unistd.h as extern but there's no heavy lifting related to grabbing a uid that I can see.
I got here by mostly grepping for geteuid within known system headers and includes as I'm having trouble backtracing its definition.
Question: How can I dive down further and explore the source code of geteuid()? What is the most efficient way to explore this codebase quickly without grepping around?
I'm on Ubuntu server 15.04 using Vim and some ctags (which hasn't been very helpful for navigating existing system headers). I'm a terrible developer and this is my method of learning, though I can't get through this roadblock.
Normally you should read the documentation for geteuid. You can either read GNU documentation, the specification from the Open Group or consult the man page.
If that doesn't help you could install the debug symbols for the c-library (it's called libc6-dbg or something similar) and download the source code for libc6) then you point out the path to the source file when you step into the library.
In this case I don't think this would take you much further, what probably happens in geteuid is that it simply issues an actual syscall and then it's into kernel space. You cannot debug that (kernel) code in the same way as you would debug a normal program.
So in your case you should better consult the documentation and read it carefully and try to figure out why geteuid doesn't return what you expect. Probably this will lead to you changing your expectation of what geteuid should return to match what's actually returned.

.obj to .cpp converter?

Is there any .obj to .cpp converter?
Is it possible to do it?
MICROSOFT VISUAL STUDIO auto-magically deleted my code files when pressed the F5 key.
Please help me.
I have the .obj files (VS forgot to delete them.ha ha ha).
Unfortunately it is impossible to decompile an .obj file back to source. More info here.
shut down your computer, boot from removable media, some sort of the UNIX, and run strings utility on your hard drive. It may be able to recover text off your source code.
As everyone has pointed out, this is impossible.
I would suggest that before you rebuild all those files, you take the time to look into SVN or another version control system.
Version Control allows you to save copies of your files to a safe place. If the compiler eats your homework, you can update with the last copy you saved to the repository.
You should try Recuva
You are out of luck. There is no safe way to reverse an obj file back to its cpp source.
I do not think that is actually possible. You'd be reversing the compilation process, which from my knowledge is not possible.
NO, it's not possible. obj files contain object code, not source code. The compilation process is typically not reversible.
PS: Visual Studio did surely not delete your code files when you pressed F5. They are somewhere, or you've deleted them accidentially.
It is impossible to do that...as all the code's comments and variables are translated into a machine code, you cannot deterministically reproduce a variable name by gleaning in on assembler byte code, Consider this as an example of a mock dump of a binary image:
0x55 0x90 0x33 0xf0 ....
Now, how can you tell that's variable foobar that is of type int....
Hope this helps,
Best regards,
Tom.
As said earlier, it is impossible to get the C source code from on obj. As an alternative, you can try a file recovery utility and scan your disk for lost files. I have previously used testdisk with partial success.
Also, you really need to use some form of SCM!
.obj files are text files for a 3d model I was actually looking for something to bring them into C++ to display using OpenGL. there are programs out there to load them into C++ I was looking for one to download when I came across this.
en.wikipedia.org/wiki/Obj

Resources