openpilot icon indicating copy to clipboard operation
openpilot copied to clipboard

comma 3X: auto-configure `adb shell` properly

Open adeebshihadeh opened this issue 7 months ago • 3 comments
trafficstars

adb shell should drop you into a shell that's indistinguishable from ssh comma@comma-eba4643f.

Essentially go from this mess

batman@workstation-adeeb:~$ adb shell
sh-5.2# export TERM=xterm-256color
sh-5.2# su comma
comma@comma-eba4643f:/$ cd /data/openpilot/
comma@comma-eba4643f:/data/openpilot$

to

batman@workstation-adeeb:~$ adb shell
comma@comma-eba4643f:/data/openpilot$

More context in https://github.com/commaai/openpilot/pull/34468

adeebshihadeh avatar Mar 29 '25 21:03 adeebshihadeh

Would modifying the env to make an alias that does all of this in one command and/or modifying the comma user login script be an acceptable fix? Also I see that we don't want to assume /data/openpilot exists, what is the desired behavior if that path doesnt exist? My assumption would be to start in the default home directory ~

JigglyNoahPuff avatar Apr 08 '25 16:04 JigglyNoahPuff

This looks like it could be of use: https://stackoverflow.com/questions/26288222/have-aliases-in-adb-shell-non-interactive-mode

BBBmau avatar Apr 10 '25 16:04 BBBmau

Just added a helper to adb forward for a real shell: https://github.com/commaai/openpilot/pull/35135/.

I'd still like to get this fixed up though. I think the way to do this is to hook the shell init and run su comma && export TERM=xterm-256color.

https://github.com/commaai/agnos-builder/blob/master/userspace/files/adbd.service

adeebshihadeh avatar May 06 '25 17:05 adeebshihadeh