GNU/Linux & USB - Write a Hello World Linux USB driver (Linux Kernel Module)
HTML-код
- Опубликовано: 10 сен 2024
- #GNU #Linux #Tutorial #Driver #DriverDevelopment
Let's take a closer look at USB. In this series of tutorials we will learn how to implement an USB device on a microcontroller and interact with it over our GNU/Linux OS from user- and kernelspace.
Today we will write a Hello World driver for our Atmega32U4 USB device. This will be the template for later videos.
You can find the source code here:
github.com/joh...
You want to support my work? You can buy me a coffee here: www.buymeacoff...
If you want to contact me, you can find my E-Mail on www.gnu-linux.rocks
You want to learn more? Check out my playlist:
• GNU/Linux & USB
Resources for this video:
makelinux.net/...
And this time I have recorded the correctmonitor 🤣 Sorry again for the fuss yesterday where I uploaded an unreviewed video showing just simplescreenrecorder 😉
No problem 😁, Thanks for sharing, i am very glad to watch you 🙏
is there a diffrence on the process, when ur copying data from PC to external USB storage instead of copying from external USB storage to PC?
Really clear and simple example, thanks for posting:)
I don't need to write a driver, but I enjoyed watching it. Thanks!
How does one use linux to test hardware?
For example, I have a usb to ethernet device and it's working under linux.. how do I call the dm_write_eeprom_word() from the c file: qop_kernel/drivers/net/usb/dm9620
Or say I have a breadboard with a TLV320AIC2X connected to the I2S of my STM32H745. How can I leverage linux to test the chip?
Excellent work😍
Thanks for such an awsummm content
U got a sub🌝🌚❤️
With all due respect.. do you have a video that "explains this video"? Just asking.... Cheers
Not only one but a whole series of videos.
For starting with Linux Drivers check out my Linux Driver Tutorial: ruclips.net/video/x1Y203vH-Dc/видео.html
Basically I created a minimal driver for my USB device. It has no functionality but will be the base for all later videos. In this video I add some functionality:
ruclips.net/video/kZNFkiUA8CA/видео.html
If you want to learn more about Linux Drivers check out the Linux Device Driver Book. makelinux.net/ldd3/
I love it. Thank you.
Thank you I love ur channel
Awesome video, thanks
Ok but why write USB device drivers in kernel space? USB is made to work in userspace.
This way you can adapt to standard interfaces, like the ones for network cards, UARTs or gpiochip. Then from the user perspective they can just use the interface and the driver takes care of the implementation.
Let's take the MCP2221 as an example. This is a USB to UART/I2C/GPIO Bridge. It offers a HID to control the GPIOs and I2C. OF course you can write a userspace program with libusb to control it, but here it is much more easier to just open /dev/gpiochip0 or /dev/i2c-0 and do what you want. This way you don't have to know so much chip specific information but can also use the GPIOs.
@@johannes4gnu_linux96 Ok fair enough. Thanks.
Sehr gutes Video.
my probe callback doesn't fire for some reason, I'm trying to write custom driver for my mouse with LED, could it be that when I plug in my mouse it gets initialized by the default mouse linux driver and matches by the device type somewhere before it event gets to my module which matches it by the vendor and product id?
Yes, you are right. The problem is, that your mouse is handled by the generic Linux Mouse driver. But I don't know a good workaround for this, as unloading the mouse driver is maybe not the best idea...
I am really new to this. Are there any resources on doing network storage?
hi johannes 1 of my usb port's stopped working, is there a terminal command to give me some info to tell me if it's a driver or a hardware problem, thanks
Hi, you could take a look at the kernels log after attaching a USB device to the port. Maye this will give you some info.
@@johannes4gnu_linux96 thanks for reply, i might have to open my laptop as there is no power going to that port ( checked with multimeter)
Hmm.. Where is that “hello world” actually? I’m sorry, but that template could be copy pasted from a Github because it doesn’t contain something valuable. Except the usb interface explanation. The rest of a time we watched how you taped.
Really great video value-wise but your pronounciation of "device" kind of drives me nuts. The English "v" is pronounced like the German "w" - you seem to know this since you pronounce it correctly in basically every other occurrence but if you want to be more easily understandable without the listener stumbling upon this every time you say the word maybe try to pronounce like it's generally pronounced :)
Not trying to be destructive, I really liked your video apart from that
Thank you for your feedback. I absolutely have issues with my pronunciation and I hope I can get better here. ;)
@@johannes4gnu_linux96 it’s honestly fine apart from that :)