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
14 views

how to setup CM4 as an ethernet gadget

we are looking to use the CM4 as an ethernet gadget that connects Android phone (USB-A) with the router (ethernet). we are looking how to setup a standard image to support it
The wolf's user avatar
1 vote
0 answers
171 views

Configuring the Raspberry Pi 4 B as a USB (HID) Gadget?

I am new to Raspberry Pi and recently got a RB Pi 4 intending to use it as a mouse/keyboard for my laptop. The problem is that I can't find valid information about how to configure the Pi 4 as a USB ...
BLUC's user avatar
  • 111
1 vote
0 answers
82 views

no consistent connection when using RBP as Ethernet gadget on macos

I am trying to connect my RBP to my MacBook using Ethernet gadget. I followed this guide link, I also had to share internet to the RNDIS/Ethernet Gadget. I managed to SSH to my RBP and to access ...
Pa Dalton's user avatar
2 votes
0 answers
39 views

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 > ...
matt's user avatar
  • 81
1 vote
0 answers
48 views

Need help emulating a USB device using my Raspberry Pi

I've tried to follow a couple examples online. I've got dwc2 at boot, I've added libcomposite to my modules file. I can run the following successfully. cd /sys/kernel/config/usb_gadget/ mkdir g1 cd g1 ...
matt's user avatar
  • 81
1 vote
0 answers
321 views

CM4 USB 3.0 Peripheral/Gadget Mode

The CM4 can be a USB 2.0 peripheral using OTG, but USB 3.0 (or higher) is not natively supported by the Broadcom chip. For the Raspberry Pi 4 Model B+, the VL805-Q6 chip provides USB 3.0 host ports ...
br42723's user avatar
  • 11
2 votes
2 answers
720 views

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 ...
allancoding's user avatar
1 vote
1 answer
308 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 ...
david's user avatar
  • 113
1 vote
1 answer
2k 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/...
baralong's user avatar
  • 146
1 vote
2 answers
2k 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 ...
Daniel Surizon's user avatar
0 votes
0 answers
600 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, ...
Patronics's user avatar
  • 129
0 votes
2 answers
153 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 ...
Brandon Powell's user avatar
1 vote
1 answer
1k 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 ...
cloud4every1's user avatar
2 votes
0 answers
774 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 ...
qduaty1's user avatar
  • 21
0 votes
0 answers
2k 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 ...
sloopy's user avatar
  • 1
1 vote
1 answer
1k 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 ...
Bastien Bastien's user avatar
1 vote
0 answers
52 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 ...
user1026169's user avatar
0 votes
1 answer
4k 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
Nikta's user avatar
  • 1
0 votes
1 answer
599 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 ...
Alexander Tsepkov's user avatar
6 votes
1 answer
4k 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 ...
JayKay5532's user avatar
2 votes
0 answers
940 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 ...
roaibrain's user avatar
  • 121
1 vote
1 answer
1k 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 -...
MonsterDruide1's user avatar
5 votes
1 answer
7k 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 ...
Kozuch's user avatar
  • 250
2 votes
0 answers
625 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 ...
Qqwy's user avatar
  • 141
14 votes
5 answers
24k 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 ...
Ingo's user avatar
  • 41.9k
3 votes
0 answers
322 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 ...
anon's user avatar
  • 31
1 vote
0 answers
98 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 ...
Firas E.'s user avatar
1 vote
1 answer
225 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 '...
haxscramper's user avatar
4 votes
1 answer
780 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 ...
Dan's user avatar
  • 91
0 votes
0 answers
290 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....
Makalone LOgman's user avatar
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)" ...
eeze's user avatar
  • 111
1 vote
1 answer
964 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. ...
noooob002's user avatar
0 votes
1 answer
393 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 ...
drowZ's user avatar
  • 123
4 votes
2 answers
17k 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 ...
jbssm's user avatar
  • 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 ...
dharcourt's user avatar
  • 101
0 votes
0 answers
593 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 ...
Nubian's user avatar
  • 1
1 vote
0 answers
271 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-...
George Shaw's user avatar
1 vote
0 answers
345 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 ...
Ulincsys's user avatar
  • 111
0 votes
0 answers
370 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
785 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. ...
flashburn's user avatar
  • 163
11 votes
1 answer
24k 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?
Naveen's user avatar
  • 121
0 votes
1 answer
306 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
386 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 ...
zeel's user avatar
  • 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 (...
zeel's user avatar
  • 200
3 votes
3 answers
8k 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 ...
EDIflyer's user avatar
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 ...
ilovemilk's user avatar
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 ...
Kdude's user avatar
  • 21