SSH Through USB Cable on Windows?
#1
Question 
Has anyone SSH'ed into the PinePhone through a USB cable on a Windows (7) machine? I was able to do it quite easily on my Linux computer so I know that it's something that can be done (at least on Linux), but trying to do it on Windows seems like a different beast.

The Pinephone shows up in Devices and Printers but it has a yellow exclamation mark. In Device Manager is shows up as a "CDC ECM" device again with a yellow exclamation mark. I'm guessing I would need a driver that that doesn't exist but I thought I would ask.

Edit: I've gotten it to work, unfortunately I'm too tired to explain how I did it right now.
  Reply
#2
In case anyone is wondering how I did it, the easy and most direct answer is to just copy the gadget.sh script on this page and you can tweak it to your liking (renaming the manufacturer to Pine64 and the product to PinePhone for example). Mine looks like this:
Code:
#!/bin/bash ID_VENDOR="0x1d6b" ID_PRODUCT="0x0104" cd /sys/kernel/config/usb_gadget/ mkdir g2 cd g2 echo "0x0200" > bcdUSB echo "0x02" > bDeviceClass echo "0x00" > bDeviceSubClass echo "0x3066" > bcdDevice echo $ID_VENDOR > idVendor echo $ID_PRODUCT > idProduct echo "1" > os_desc/use echo "0xcd" > os_desc/b_vendor_code echo "MSFT100" > os_desc/qw_sign mkdir strings/0x409 echo "9112473" > strings/0x409/serialnumber echo "Pine64" > strings/0x409/manufacturer echo "PinePhone" > strings/0x409/product mkdir configs/c.1 mkdir configs/c.1/strings/0x409 echo "RNDIS" > configs/c.1/strings/0x409/configuration mkdir functions/rndis.usb0 echo "RNDIS" > functions/rndis.usb0/os_desc/interface.rndis/compatible_id echo "5162001" > functions/rndis.usb0/os_desc/interface.rndis/sub_compatible_id ln -s functions/rndis.usb0 configs/c.1 ln -s configs/c.1 os_desc echo "musb-hdrc.4.auto" > UDC exit 0

I named my gadget directory g2 because I already had a USB gadget created automatically in the /sys/kernel/config/usb_gadget/ directory when I installed pinephone-dev-tools which is how I got SSH through USB working on my Linux computer. musb-hdrc.4.auto comes from /sys/class/udc/ and it represents the USB-C connection, there should only be one there. When the USB-C cable is plugged into the computer it will enable the gadget.sh script and emulate a RNDIS device for Windows to see. On Windows 7 the device was not recognized, it still had a yellow exclamation mark in Device Manager, I right-clicked it, went to Properties -> Update Driver... -> Browse my computer for driver software -> Let me pick from a list of device drivers on my computer. Then I scrolled down to Network adapters clicked Next, scrolled down and selected Microsoft Corporation from the Manufacturer list, then finally selected Remote NDIS Compatible Device from the Network Adapter list and clicked Next. This will create a new adapter that Windows can see. Hold Windows+r and enter "ncpa.cpl". You should see a new adapter with "PinePhone" under it. Right-click it -> Properties -> "Internet Protocol Version 4 (TCP/IPv4) -> Propeties. From there select "Use the following IP address" and enter "10.66.0.5" (for example), then hit Tab and the Subnet mask will automatically be filled in, click OK. Next (we're almost there) open your PinePhone, type 
Code:
sudo nmtui
select Edit a connection and look for a usbX device to identify it, select it. For IPv4 CONFIGURATION select <Manual> and for address enter 10.66.0.1/8 and exit by selecting OK at the bottom. Select Activate a connection and select usbX to enable the connection. Lastly enter
Code:
ip a
and look for the 10.66.0.1/8 address. Enter that into your SSH client on your Windows machine and fingers crossed it works.

Now I finished doing this at 4 o'clock in the morning and after having to painstakingly use the on-screen keyboard for way too long I was getting a bit flustered but hopefully I explained it well enough. It works for me and hopefully it works for you.

Relevant links:
https://xnux.eu/devices/feature/usb-gadget.html
https://01.org/linuxgraphics/gfx-docs/dr...igfs.html#
https://gist.github.com/Gadgetoid/c52ee2...77360011e2
https://learn.adafruit.com/turning-your-...net-gadget
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  SSH from Windows PC into PinePhone? Peter Gamma 21 27,679 06-11-2022, 02:55 PM
Last Post: Peter Gamma
  Windows 10 (KVM) on PinePhone Danct12 5 13,953 04-04-2021, 09:05 AM
Last Post: nas

Forum Jump:


Users browsing this thread: 1 Guest(s)