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/...

Комментарии • 26

  • @johannes4gnu_linux96
    @johannes4gnu_linux96  Год назад +7

    And this time I have recorded the correctmonitor 🤣 Sorry again for the fuss yesterday where I uploaded an unreviewed video showing just simplescreenrecorder 😉

    • @ahmetserdr2920
      @ahmetserdr2920 Год назад

      No problem 😁, Thanks for sharing, i am very glad to watch you 🙏

    • @jirehla-ab1671
      @jirehla-ab1671 3 месяца назад

      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?

  • @slim_cana
    @slim_cana Год назад +3

    Really clear and simple example, thanks for posting:)

  • @maksimivanov1876
    @maksimivanov1876 5 месяцев назад

    I don't need to write a driver, but I enjoyed watching it. Thanks!

  • @bennguyen1313
    @bennguyen1313 Год назад +1

    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?

  • @sureshotshorts1207
    @sureshotshorts1207 Год назад +1

    Excellent work😍
    Thanks for such an awsummm content
    U got a sub🌝🌚❤️

  • @ovalwingnut
    @ovalwingnut Год назад +3

    With all due respect.. do you have a video that "explains this video"? Just asking.... Cheers

    • @johannes4gnu_linux96
      @johannes4gnu_linux96  Год назад +3

      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/

  • @xDR1TeK
    @xDR1TeK Год назад

    I love it. Thank you.

  • @Awwe12675
    @Awwe12675 Год назад

    Thank you I love ur channel

  • @m0zah
    @m0zah Год назад

    Awesome video, thanks

  • @mithrandirthegrey7644
    @mithrandirthegrey7644 Год назад +1

    Ok but why write USB device drivers in kernel space? USB is made to work in userspace.

    • @johannes4gnu_linux96
      @johannes4gnu_linux96  Год назад +1

      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.

    • @mithrandirthegrey7644
      @mithrandirthegrey7644 Год назад

      @@johannes4gnu_linux96 Ok fair enough. Thanks.

  • @RitterderRedlichkeit
    @RitterderRedlichkeit 11 месяцев назад

    Sehr gutes Video.

  • @ratatui900
    @ratatui900 Год назад

    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?

    • @johannes4gnu_linux96
      @johannes4gnu_linux96  Год назад +1

      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...

  • @user-ui8my9zs7o
    @user-ui8my9zs7o 8 месяцев назад

    I am really new to this. Are there any resources on doing network storage?

  • @mattster6077
    @mattster6077 Год назад

    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

    • @johannes4gnu_linux96
      @johannes4gnu_linux96  Год назад

      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.

    • @mattster6077
      @mattster6077 Год назад

      @@johannes4gnu_linux96 thanks for reply, i might have to open my laptop as there is no power going to that port ( checked with multimeter)

  • @sc0or
    @sc0or Год назад +2

    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.

  • @3nt3_
    @3nt3_ Год назад +1

    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

    • @johannes4gnu_linux96
      @johannes4gnu_linux96  Год назад

      Thank you for your feedback. I absolutely have issues with my pronunciation and I hope I can get better here. ;)

    • @3nt3_
      @3nt3_ Год назад

      @@johannes4gnu_linux96 it’s honestly fine apart from that :)