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

Filter by
Sorted by
Tagged with
0 votes
0 answers
17 views

Can't see Raspberry Pi zero W in gadget mode in device manager Windows 11

I've downloaded Raspbian Lite x86 with official Raspberry Pi Imager and flashed it on 8GB sd card I've followed all the steps on https://gist.github.com/gbaman/975e2db164b3ca2b51ae11e45e8fd40a 1.) ...
1 vote
1 answer
101 views

Raspberry Pi Zero 2W in gadget mode with USB HUB HAT

I have a Raspberry Pi Zero 2W in gadget mode that can transmit data and emulate a mouse or keyboard. But when I connect a USB HUB HAT, I'm not able to transmit data. I'm getting [Errno 108] Cannot ...
  • 111
1 vote
1 answer
675 views

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/...
  • 131
0 votes
0 answers
255 views

Raspberry Pi Zero USB Ethernet gadget reconnection problem

I connected Pi Zero as a USB Ethernet gadget to a Windows 10 PC. The Pi Zero is powered by a 5V DC adapter. Then, I login to Pi Zero through it's hostname raspberrypi.local and SSH into it. Actually, ...
0 votes
2 answers
973 views

Serial/Ethernet Gadget Raspberry pi zero

I'm trying this 'ethernet mode' on raspberry pi zero with bullseye and bonjour installed on windows 10 following this guide Ethernet Gadget without success. My main goal is to get control on network ...
0 votes
0 answers
306 views

DietPi USB Ethernet Gadget mode network breaks when enabling network sharing?

I'm trying to set up a raspberry Pi Model A (the original generation) as a USB Ethernet Gadget from DietPi (following these instructions), along with trying suggestions from several similar articles, ...
  • 129
0 votes
0 answers
131 views

Multiple gadgets through one USB OTG

I would like to use my RPi to provide input to my PC through one USB interface. I was reading on how to configure OTG on RPi and found this great guide: https://gist.github.com/gbaman/...
0 votes
2 answers
101 views

Idea about encryption with Pi

I had an idea about having an encrypted partition on the Pi's SD card which can be auto-decrypted with a headless setup (no keyboard available for manual decryption). Would it not be possible to ...
1 vote
1 answer
434 views

Raspberry Pi Zero g_mass_storage not recognized by some Systems

I have a Raspberry Pi Zero W configured as a USB device (latest raspian version 5.10.11+). Make a Pi Zero W Smart USB flash drive In general it works fine, and the device will be recognized by Windows ...
2 votes
0 answers
521 views

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 ...
  • 21
0 votes
0 answers
1k views

Using a raspberry pi 4 as a usb audio interface

I want to use my raspberry pi 4 with hifiberry dac and adc as a usb audio interface for my android phone so that I can stream audio and make handsfree calls in my car. I'm having trouble finding ...
1 vote
1 answer
653 views

Is it possible for a Raspberry Pi Zero to act as both a Usb Gadget and a Usb Host?

I am currently working on a Raspberry Pi project, and found an amazing feature that I used many times on my LineageOs phone: Usb Gadget. I figured I could change the function of the Usb port to act as ...
1 vote
0 answers
42 views

Is it possible to enter USB-C Gadget Mode using only dhcpcd?

I've been following tutorials like this one to make USB 'Gadget Mode' work on the Pi: https://www.hardill.me.uk/wordpress/2019/11/02/pi4-usb-c-gadget/ However the other day I had an issue getting it ...
0 votes
1 answer
3k views

SSH into Rasberry Pi 4 over USB (Ubuntu Core) [duplicate]

Is it possible to SSH connect via USB-C -> USB to Rasberry Pi 4 in Ubuntu? Like this
  • 1
0 votes
1 answer
442 views

Pi Zero configured as HID not being recognized by PC (dmesg error)

I followed this guide to setup my Pi Zero W as a keyboard HID. Connected it to a laptop (via the data USB, not the power) to see no effect. When I started investigating, I saw that dmesg is showing ...
4 votes
1 answer
3k views

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 ...
2 votes
0 answers
767 views

Unable to access laptop's internet on Pi Zero over Usb

I've been going over so many web pages trying out numerous things for the past 6 hours to just get internet on my rpi to no avail hence I have come here to hopefully find a solution. Below are the ...
  • 121
1 vote
1 answer
918 views

Gadgetfs - Filesystem not found

While trying the solutions suggested by a comment on my first question I tried to enable gadgetfs. I tried the following: sudo modprobe dwc2 sudo modprobe gadgetfs sudo mkdir /dev/gadget sudo mount -...
3 votes
1 answer
6k views

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 ...
  • 230
2 votes
0 answers
492 views

Is it possible to connect a Raspberry Pi 0 to the USB port of a router, to connect to the internet?

Recently I read (in articles such as this one) that it is possible to use the Raspberry Pi Zero in 'USB/Ethernet gadget mode'. Now my modem has two USB ports, which the manual says can be used for ...
  • 141
12 votes
5 answers
18k views

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 ...
  • 40.7k
3 votes
0 answers
256 views

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 ...
  • 31
1 vote
0 answers
76 views

Cannot SSH from pi zero to pi zero over OTG USB

I am running Raspbian Stretch Lite Linux testpi1 4.14.98+ #1200 Tue Feb 12 20:11:02 GMT 2019 armv6l GNU/Linux I am able to SSH to my pi zero over the OTG USB cable as many guides online have ...
1 vote
1 answer
193 views

RPI is not visible in LAN when using ethernet over usb

I'm following this tutorial for converting RPI to usb gadget. I've modified setup script a little to fit my needs: err_file=$HOME/usb_setup_err echo "Time: $(date -Ins)" >> $err_file echo '...
3 votes
0 answers
608 views

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 ...
  • 81
0 votes
0 answers
199 views

Forward internet to usb0

I have Raspberry Pi 3 (running Raspbian) and Raspberry Pi Zero (DietPi). The Raspberry Pi 3 is connected to ethernet. The Raspberry Pi Zero is set as Ethernet gadget (according to this https://dietpi....
1 vote
1 answer
2k views

Headless pi zero HID keyboard

I am trying to get my pi zero to act as a HID USB keyboard when plugged in to a computer, following this guide. I finished the configuration, and I get to the "Keyboard / Mouse / Joystick (HID)" ...
  • 111
1 vote
1 answer
906 views

Raspberry Pi Zero as webcam [duplicate]

I read some case, like using dwc2 and g_webcam in /boot/config and cmdline. but hard to understand and doesn't work. and can't find a tutorial, there are some tutorials only about serial and ethernet. ...
0 votes
1 answer
353 views

Raspberry Pi Zero W access point sharing LAN thorough ethernet gadget

I've recently wanted to do a project with the Raspberry Pi Zero. Basically, I want to set up the Pi as an ethernet gadget for computers to be able to play games over WLAN. The computers have no wifi ...
  • 123
4 votes
2 answers
15k views

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 ...
  • 143
0 votes
2 answers
4k views

Is it possible to set a static IP for the first boot of headless Pi ethernet gadget?

I'm setting up a Raspberry Pi Zero as an ethernet gadget using the instructions here. That generally works but until I can log in to the Pi and configure it to use a static IP address it uses for its ...
  • 101
0 votes
0 answers
491 views

Pi Zero Connects as USB serial gadget, but does not receive data

I have a few Pi Zeros I'm working on for a project. I have the Pi connected to a PC with Windows 7 with a USB cable, and I need to send packets of text to it with information to control devices on the ...
  • 1
1 vote
0 answers
257 views

On RPi Zero, garbage received using g_printer gadget

I have a RPi Zero W as a printer gadget, and it shows up as a printer on my Macbook (solved here in comments https://unix.stackexchange.com/questions/408293/how-to-make-g-printer-usb-gadget-printer-...
1 vote
0 answers
309 views

PI Zero gadget with g_ether on Ubuntu host creates new wired connection every boot

I have a Raspberry PI Zero running Raspbian Stretch 2017-09-07 configured in otg mode with the g_ether module loaded. When I set a static IP in the interfaces files, connecting on Windows is ...
0 votes
0 answers
320 views

RPI Zero W gadget after plugging in turns my PC off

Hello I am making a rpi zero USB gadget but something is wrong with it I am sure that pads don't connect to each other
user avatar
1 vote
1 answer
715 views

configure pi as a usb gadget, add vivid driver to the image, build and run code

Need to configure RPi as a USB UVC (video camera gadget). As far as I understand here is how it can be done. Then I need to test this application. Instructions on how to do it located here. ...
  • 153
11 votes
1 answer
20k views

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?
  • 121
0 votes
1 answer
283 views

Powering the Pi zero from a USB port: what if I acidentally unplug it without doing "sudo shutdown"? How to protect it?

I want to create composite gadget device with Raspberry Pi Zero W, and use power and data in the same USB port on another, host, machine. I am worried about it being unplugged while things are written ...
user avatar
5 votes
1 answer
289 views

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 ...
  • 200
5 votes
2 answers
3k views

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 (...
  • 200
3 votes
3 answers
7k views

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 ...
1 vote
1 answer
1k views

Modifying libcomposite module doesn't work

I'm trying to modify the libcomposite module in a way that it prints the functions of which are loaded to the log file. I'm using an Raspberry Pi Zero W with the 4.9.20+ Kernel. I updated everything ...
2 votes
1 answer
4k views

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