Questions tagged [gadget]

Gadget are a series of linux drivers that turn a (master) USB port into a slave device when connected to a host, the USB will be presented as a serial, ethernet, camera, printer, storage etc. https://github.com/torvalds/linux/tree/master/drivers/usb/gadget/function

Gadgets are a series of linux drivers that turn a (master) USB port into a slave device when connected to a host. The USB will be presented as a serial port, ethernet, camera, printer, storage, MIDI, etc. The Raspberry Zero is a suitable device for this drivers.

49 questions
14
votes
5 answers

Where is the USB2 OTG port on the RPi 4 Model B located?

According to this answer the Raspberry Pi 4 Model B has a total of five USB ports (two USB3 host, two USB2 host, one USB2 OTG). Where is the fifth USB2 OTG port located and how can I use it? Can I use it with OTG Gadget mode?
Ingo
  • 42,961
  • 20
  • 87
  • 207
10
votes
1 answer

How to use Raspberry Pi 3 as a USB gadget

How can I use Raspberry Pi 3 as a USB gadget. Is there any way? How can I enable the USB gadget mode on Raspberry Pi?
Naveen
  • 111
  • 1
  • 1
  • 3
6
votes
1 answer

Change Raspberry Pi Zero USB Gadget name from Linux File-Stor Gadget

My goal is to convincingly emulate a well known brand of USB Flash Disk, using Raspberry Pi Zero (with or without Wifi). For the sake of this example, I want to emulate a 4GB Sandisk Cruzer Edge, but generally speaking I want the ability to have…
JayKay5532
  • 106
  • 1
  • 6
5
votes
1 answer

Detect if a host is connected (gadget mode)

Device: Raspberry Pi Zero W v1.1 State: Pi Zero is running in gadget mode, acting as a USB Mass Storage device (seen by / mounted on a MacBook Pro). Question: What is the best way to detect whether or not the MacBook Pro is still connected / using…
Dan
  • 101
  • 4
5
votes
3 answers

Use Raspberry Pi as keyboard/mouse output to control server

I want to connect to a RPi thought LAN (possibly with VNC) and have it controlling a server that is connected to the RPi by USB. Basically the RPi would have to send every keystroke/mouse movement to the server using the USB emulating the…
jbssm
  • 153
  • 1
  • 1
  • 5
5
votes
1 answer

Check if a host device is connected to Pi Zero gadget

How can the Pi detect if a host device has been connected, and gather information about that device, when being used as a gadget (such as mass storage). It would be useful if I could detect this within a python script. As an example, if the Pi is to…
zeel
  • 200
  • 1
  • 8
5
votes
2 answers

Pi Zero g_mass_storage not recognized by some computers until after another computer recognizes it

So the basic issue is this: once the Pi Zero with g_mass_storage is booted up, as long as there is a power source for it (like a battery, so it won't shut off) I can plug it into any windows machine (or another Pi) and the volume pops right up. But…
zeel
  • 200
  • 1
  • 8
5
votes
1 answer

USB 3.0 OTG on Raspberry Pi 4 (USB gadget)

Raspberry Pi 4 can do USB OTG via the USB-C connector (according to this answer) - but only at USB 2.0 speeds since the USB-C connector only connects to USB 2.0 lanes. My question is - can Pi 4 also do OTG at USB 3.0 speeds? Maybe via the standard…
Kozuch
  • 250
  • 4
  • 17
3
votes
0 answers

Waking computer with raspberry pi zero usb keyboard gadget

I've been trying to set up a raspberry pi zero as a keyboard gadget, hoping i could wake a laptop (No ethernet) with it. I would also be able to encrypt it and send the password, which is an added bonus. I've gotten the keyboard gadget to work, and…
anon
  • 31
  • 1
3
votes
3 answers

USB Mass Storage Gadget - how to convincingly emulate a flash drive?

I've got a Pi Zero W that I'm using in OTG/gadget mode. I've activated dwc2 USB, partitioned and formatted the file that is to be used as filesystem and loaded g_mass_storage. It is working fine in Windows - I can connect and see the contents,…
EDIflyer
  • 53
  • 1
  • 9
2
votes
1 answer

DHCP on USB0 of Pi Zero not working

I have set up my Raspberry Pi Zero with the USB Ethernet gadget as described by Adafruit. This works wonderfully with static IP addresses. Now I want to put a little DHCP server in the Pi, so that I don't have to configure a static IP every time I…
Kdude
  • 21
  • 1
  • 3
2
votes
1 answer

Ep in and out files not being created when trying to emulate a USB device using libcomposite on Raspberry Pi 4

I'm using the following to set up and emulate a usb device: modprobe libcomposite cd /sys/kernel/config/usb_gadget/ mkdir -p g1 cd g1 echo 0x1430 > idVendor # Linux Foundation echo 0x0150 > idProduct # Multifunction Composite Gadget echo 0x0100 >…
matt
  • 81
  • 3
2
votes
2 answers

Share Internet connection from raspberry pi 0 w to computer via USB cable

The Raspberry Pi Zero W is connected to the internet with wlan0 and it needs to share that internet with the computer via USB. The Raspberry Pi Zero W also needs internet access. I have gadget mode already set up. So when I plug it in the computer…
2
votes
1 answer

RPi Zero 2W in mass storage USB Gadget mode, how do I read updated contents of the image file from the Raspberry Pi?

I've got a Rpi Zero 2 W working well in USB Gadget mode providing: mass storage, ethernet and serial connections. I'm doing this with libcomposite and the guides here: https://github.com/thagrol/Guides . I've got an image file as the backing store…
baralong
  • 156
  • 1
  • 6
2
votes
0 answers

Bit-perfect USB Audio gadget

I want to use Raspberry Pi Zero as a USB DAC with switchable sample rate. Maximum resolution should be 96/24 with all 4 common rates ie. 44.1, 48, 88.2 an 96 kHz supported. It should also work with Windows. I don't care about volume control but it…
qduaty1
  • 21
  • 3
1
2 3 4