Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Fun fact: Gadget mode also works on Android phones, if you want a programmable USB device that you can easily program and carry around

I made a PoC of a 2FA authenticator (think Yubikey) that automatically signs you in. I use it for testing scenarios when I have to log out and back in many times, it flies through what would otherwise be a manual 2FA screen with pin entry, or navigating 2FA popups to select passkey and touching your fingerprint reader.

Obviously not very secure, but very useful!



This answers a question I didn't realize I had. I had already been thinking about some kind of utility gadget made up of a Pi Zero with a tiny screen and battery, but an Android phone solves a lot of problems in one go.


Interesting !

I have a bunch of older android phones that could be repurposed for some tinkering.

The touchscreen display and input would open a lot more interactive possibilities.

Is there a community or gallery of ideas and projects that leverage this?


There is this repository: https://github.com/tejado/android-usb-gadget

They have some examples that emulate an USB keyboard and mouse, and the app shows how to configure the Gadget API to turn the phone into whatever USB device you want.

The repo is unfortunately inactive, but the underlying feature is exposed through a stable Linux kernel API (via ConfigFS), so everything will continue working as long as Android leaves the feature enabled.

You do need to be root, however, since you will essentially be writing a USB device. Then all you have to do is open `/dev/hidg0`, and when you read from this file you will be reading USB HID packets. Write your response and it is sent on the cable.


Excellent - Thanks!

I always wondered if we could convert an old andoid phone or tablet into a USB/wireless graphics-tablet for drawing input -- or as a live annotator for screen presentations where I can mirror the PC slideshow on the tablet and use the tablet to make annotations during a lecture say.

If there are any such projects already -- I would e very keen to take a look.


There is also support for doing this without being root:

https://developer.android.com/develop/connectivity/usb




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: