xxandy
Posts: 3
Joined: Thu Jan 18, 2018 9:44 pm

Re: USB Gadget mode in Stretch

Tue Mar 27, 2018 2:08 am

@HawaiianPi, would you be so kind to make your working images available again?
I'll gladly take it as a private transfer (I'll post a link to a dropbox folder you can upload it to).

Thanks!

mitchallen
Posts: 2
Joined: Fri Jul 15, 2016 11:14 pm
Location: Arizona USA
Contact: Website

Re: USB Gadget mode in Stretch

Tue Mar 27, 2018 6:03 pm

If anyone is still having trouble with this, I wrote up how I did it for both the Mac and Windows: setting up the Pi Zero as a gadget so I could SSH over USB:

https://desertbot.io/blog/headless-pi-z ... sb-windows (Windows)

https://desertbot.io/blog/ssh-into-pi-zero-over-usb (Mac)

The Windows post was written up using Stretch Lite. The Mac version used Jessie Lite but I recently walked through the steps using Stretch Lite.
https://desertbot.io

xxandy
Posts: 3
Joined: Thu Jan 18, 2018 9:44 pm

Re: USB Gadget mode in Stretch

Tue Mar 27, 2018 7:00 pm

I got it to work, with the Raspbian Stretch Lite 4.9, released 2018-03-13.

I followed https://blog.gbaman.info/?p=791 but with one exception:
- I first booted once with an unmodified SD card, all it had was the image (using the POWER usb only)
- then I logged in (pi/raspberry), went to super4 user (sudo su) and performed the tutorial using a keyboard / console on the Pi directly (modified config.txt, modified commandline.txt, and saved the ssh file)
- then finally I connected my PC to the device port and rebooted. this worked.

User avatar
HawaiianPi
Posts: 3649
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: USB Gadget mode in Stretch

Tue Mar 27, 2018 8:39 pm

xxandy wrote:
Tue Mar 27, 2018 2:08 am
@HawaiianPi, would you be so kind to make your working images available again?
I'll gladly take it as a private transfer (I'll post a link to a dropbox folder you can upload it to).

Thanks!
My previous image was based on the 2017-11-29 release, but I just tested the new 2018-03-13 Stretch and the same procedure works fine. I took down the older images because they were no longer relevant, and I needed the space back. The guide at the link posted above by xxandy should work without jumping through the extra hoops. Just follow the guide and use a pure text editor like notepad++ (https://notepad-plus-plus.org/).

But for the sake of those still having trouble, I have prepared another image. This one was done a little differently. Instead of making an SD card, testing it and then imaging that, I just edited the cmdline.txt and config.txt files on the 2018-03-13 Raspbian Stretch Lite image and added the empty ssh file. No other changes were made to the image.

EDIT: Updated image
Raspbian Stretch Lite 2018-11-13 Pi0(W) USB Gadget mode
SHA-256: 32ca25d28122cea2fd40d3f8d8c0e0ac2efd88fb5f569d0976828f42a604c2ed

It also occurred to me that I don't know how the RPF (or whoever is responsible for Raspbian) feels about others distributing their IP. The Lite image should be mostly open source software, so I *think* it's okay, but if I'm wrong, let me know and I'll take down the image immediately.

I have burned this to an SD card with Etcher and booted it in my Pi Zero v1.3, and it works as expected. You just burn it and boot it. No other changes are needed to get your Pi Zero into USB Gadget mode. I also tested the Desktop version, but I won't be hosting that image.

If anyone is interested in how I made the Pi Zero USB Gadget image, I extracted the RPF image on my Pi3B+, mounted it, edited the files, unmounted it, and re-zipped it. If you'd like a more specific tutorial, ask and I'll see if I can come up with something coherent.
Last edited by HawaiianPi on Sun Jan 06, 2019 8:49 am, edited 1 time in total.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

papergeek
Posts: 2
Joined: Thu Jan 03, 2019 10:19 pm

Re: USB Gadget mode in Stretch

Thu Jan 03, 2019 10:33 pm

I'm running Raspbian Stretch (4.14 kernel) on a Pi Zero W, and after a bit of head-scratching got it to work with a very specific combination.
In /boot/cmdline.txt, I do NOT have any arguments to load modules, just:
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=ba5cccc2-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles
In /boot/config.txt, I MUST have
dtoverlay=dwc2

Although I can modprobe dwc2 later in userspace, I will not get a successful load of the udc controller.

Then in /etc/rc.local I can call a script which does a modprobe libcomposite and sets up the /sys/kernel/config entries.
I must NOT have libcomposite loaded via /etc/modules (mine contains only i2c-dev).

One symptom of not following all the precise steps I've mentioned is that udc cannot be set, and therefore /dev/hidg0 never gets created.

I still get errors on the other end (Ubuntu 18.04 reports "unknown main item tag 0x3" before reporting the probe failed, but this is farther than I got before.

Return to “Advanced users”