用户登录
用户注册

分享至

是否可以将 Android 编程为物理 USB 键盘?

  • 作者: 人家都说名字起的太长不太容易被记住
  • 来源: 51数据库
  • 2023-02-09

问题描述

我真正想知道的是这是硬件问题,还是软件问题.我可以通过 USB 将我的安卓手机插入电脑并让它充当硬件键盘吗?我不想在电脑上安装任何东西,我希望 android 表现得像标准硬件.

What I really want to know is whether it is a hardware problem, or a software problem. Could I plug my android phone into a computer via USB and have it act as a hardware keyboard. I do not want to install anything on the computer, I want android to behave like the standard hardware.

澄清我想为 android 编写一个程序/库,使设备能够完全模拟普通键盘,以便操作系统将其报告为标准键盘设备,并且它可以在 BIOS 或其他任何键盘工作的地方工作.

Clarification I want to write a program/library for android that enables the device to fully emulate an ordinary keyboard, so that the operating system reports it as a standard keyboard device, and it would work in the BIOS or anywhere else that a keyboard works.

推荐答案

我在 Nexus 7 上修改了内核,使其像标准 HID 键盘和鼠标一样工作,而不会丢失 MTP/ADB/其他 USB 功能.

I've modified kernel on Nexus 7 to act like standard HID keyboard and mouse, without losing MTP/ADB/other USB functionality.

您可以使用 usb-gadget-test 命令行实用程序将击键和鼠标移动发送到您的 PC.我想稍后创建一个远程管理应用程序,它将发送关键事件并从相机接收视频.

You can use usb-gadget-test commandline utility to send keystrokes and mouse movements to your PC. I want to create a remote ***** app later, which will send key events and receive video from camera.

内核补丁、二进制文件和说明:https://github.com/pelya/android-keyboard-gadget

Kernel patch, binaries and instructions: https://github.com/pelya/android-keyboard-gadget

我已经向 Google Play 发布了一个合适的应用,如果您的 Nexus 7 已植根,您可以直接从应用程序中刷新内核,并使用它发送按键.

I've published a proper app to Google Play, if your Nexus 7 is rooted you can flash kernel right from the app, and send keypresses with it.

软件
前端设计
程序设计
Java相关