Giter VIP home page Giter VIP logo

Comments (7)

fhunleth avatar fhunleth commented on July 23, 2024

I agree - it looked possible when I was doing the original port. I wasn't sure about power, but I guess it doesn't hurt to try.

from nerves_system_rpi4.

lawik avatar lawik commented on July 23, 2024

I imagine it should work on decently powerful laptops, blog post sure makes it look like it works. I'm guessing it can negotiate something more juicy than the ol' micro-USB gadgets could.

from nerves_system_rpi4.

lucaong avatar lucaong commented on July 23, 2024

I tried, as an experiment, to emulate a USB HID device (keyboard) on Nerves Rpi4 by following the indications in this post, originally written for the Zero on Raspbian and basically similar to the post linked above.

I loaded the dwc2 and libcomposite modules, and had to manually mount ConfigFS with mount none /sys/kernel/config -t configfs. Still, the problem is that ls /sys/class/udc gives empty results, so something is clearly missing but I don't know what.

Any idea about what would be needed to get that to work?

I see other efforts to get ConfigFS to work on some Pi models, like nerves-project/nerves_system_rpi0#62

It would be really great to be able to use the Rpi4 USB-C in device mode.

from nerves_system_rpi4.

lucaong avatar lucaong commented on July 23, 2024

An update to this, I managed to fix this issue by adding the dwc2 device tree with a custom fwup.conf like it's done here on the RPi Zero: https://github.com/nerves-project/nerves_system_rpi0/blob/master/fwup.conf#L229

Now the USB Device Controller is properly populated in /sys/class/udc and the /dev/hidg0 device appears (and is recognized by my laptop, to which the RPi4 is connected via USB-C). The problem is that, when I try to write HID reports to /dev/hidg0, the write operation hangs. Any idea?

I'd be very happy to share my proof-of-concept if I get it to work end to end.

from nerves_system_rpi4.

lucaong avatar lucaong commented on July 23, 2024

I figured it out, the HID report description was wrong. Now it works fine.

Here is a (hacky but working) proof of concept of the RPi4 on standard Nerves using the USB-C in gadget mode (emulating a USB Keyboard): https://github.com/lucaong/nerves_rpi4_hid_gadget_poc

Ideally one would use nerves/usb_gadget instead of the custom shell script to create and setup the USB gadget.

from nerves_system_rpi4.

lawik avatar lawik commented on July 23, 2024

So this would make it pretty likely that we could do the ethernet gadget or whatever the pi0 does to provide SSH over the wire by default?

from nerves_system_rpi4.

lucaong avatar lucaong commented on July 23, 2024

That definitely sounds possible. In my experiments with using the USB-C port in gadget mode, plugging it to a laptop is enough to power the Pi.

from nerves_system_rpi4.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.