1

My employer has asked me to prepare for testing several thousand Chromebooks (mix of models/manufacturers) to refurb/flip. This may be a recurring thing.

Most or all of these will be old enough that CCD will not be available. I'd like to connect a widget such as a Raspberry Pi to the USB and have it automate testing as much as possible.

I know I can use keyboard emulation to inject commands, but I'd like to get a crosh session running over USB so that I can read info from the DUT besides just controlling it.

Google shows bazillions of returns about using a Chromebook as an ssh terminal but what I'm looking for is the opposite. I'm prepared for the answer to be a simple "no" but I'm concerned because I can't find that anyone else has asked this question. I don't think I'm that creative, so I suspect my Goog-fu is weak.

Crash Gordon
  • 159
  • 7

1 Answers1

1

The answer appears to be "no". However I solved it another way; using "gadget mode" I have a Raspberry Pi ZW enumerate as a keyboard and a serial port. I put the Chromebook into Developer mode, open a developer shell with ctrl/alt/F2, or on a PC/linux or Mac system open a terminal window and type "sudo su" (these have to be done manually). Then I have the RPi issue this bash command to identify the serial port "in the blind":

SERPORT=/dev/serial/by-id/$(ls /dev/serial/by-id) # Chromebook or PC/linux
(or)
SERPORT=$(ls /dev/cu.usbmodem*) # Mac

Now I can have the RPi inject commands via the keyboard, put ">$SERPORT" on the end of each command, and the output comes in the RPi gadget serial port. The RPi then packages the data and forwards it over WiFi to our CRM. It's working nicely for Chromebooks, PCs booted into linux, Mac desktops and Macbooks.

Edit:

The company I work for has actually turned this into a product and so I'm not sure how much detail I should share, but...

I learned my way around gadget mode on the RPi from this link. There are examples for setting up a keyboard and a serial port. Using the templates in that link, I made a device called /dev/hidg0 which emits keyboard scancodes from the RPi to the Chromebook. I also made a device called /dev/ttyGS0 which the Chromebook sees as a serial port.

So I send keystrokes with some python like:

with open("/dev/hidg0","bw") as hid:
  hid.write(blah)

and then have the Chromebook send text to the serial port, which I then read by looking at /dev/ttyGS0

Hopefully this will be enough to get you started. I found the isticktoit link very helpful.

Crash Gordon
  • 159
  • 7
  • This sounds fascinating! I'd like to learn more about your solution: 1) "gadget mode" on which device (Chromebook or RPi)?, 2) how to configure RPi to "enumerate as a keyboard and a serial port"?, 3) how to get the RPi to "inject commands via the keyboard"? – Setaa Jun 25 '21 at 03:00