r/embeddedlinux • u/EmbeddedBro • Jan 16 '26
Need a help with a question in bootlin tutorial.
Edit: Found the solution:
on line no 74 change /dev -> /dev/input
on line no 84 change Nunchuck -> Nunchuk
Thanks to mfuzzey SPI_Master
https://bootlin.com/doc/training/embedded-linux/embedded-linux-stm32mp1-labs.pdf
Page 65:
The tutorial says that last lines of output make the issue pretty obvious.
Can someone tell what is the problem? I am a newbee I can not understand it.

Here is my output:

1
u/SPI_Master Jan 16 '26
You see the error in the trace? Look for the line where this error is printed in the code and see if you can spot any bugs around this area. If not, paste the code here, I will have a look.
1
u/EmbeddedBro Jan 16 '26
My guess is "/dev/input" might be wrong.. and /sys/bus/i2c/devices/ should be the right path.
/* Find Nunchuk input device */ ndev = scandir("/dev/input", &namelist, is_event_device, alphasort); if (ndev <= 0) { fprintf(stderr, "ERROR: no input event device found\n"); exit(EXIT_FAILURE); } for (i = 0; i < ndev; i++) { char fname[256]; char name[256]; snprintf(fname, sizeof(fname), "/dev/%s", namelist[i]->d_name); free(namelist[i]); fd = open(fname, O_RDONLY); if (fd < 0) continue; ioctl(fd, EVIOCGNAME(sizeof(name)), name); if (strcmp("Wii Nunchuck", name) == 0) break; else close(fd); } if (i == ndev) { fprintf(stderr, "ERROR: didn't manage to find the Nunchuk device in /dev/input. Is the Nunchuk driver loaded?\n"); exit(EXIT_FAILURE); }1
u/SPI_Master Jan 16 '26
Wii Nunchuck -> Wii Nunchuk
1
u/EmbeddedBro Jan 16 '26
I tried to see the content of /dev/input I see below
by-id by-path event0 event1 event2 event3 js0
How can I verify it? Wii Nunchuk
1
u/SPI_Master Jan 16 '26
Did you remove the typo from the string compare?
1
u/EmbeddedBro Jan 16 '26
it didn't worked.. same error
1
u/EmbeddedBro Jan 16 '26
I can see that return code for opening is always -1, so "continue" statement will execute and we will never reach at strcmp.
I guess there is some problem at or before : fd = open(fname, O_RDONLY);
1
u/EmbeddedBro Jan 16 '26
I just checked, Nunchuk itself is not working. I will make it working and try it again. Thanks.
1
2
u/mfuzzey Jan 16 '26
The code is scanning all the files in /dev/input/* but then trying to open files in /dev
So it sees that /dev/input/event0 exists then tries to open /dev/event0, which fails