Git Product home page Git Product logo

android-hid-client's People

Contributors

arian04 avatar izzysoft avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

android-hid-client's Issues

Adding character device crashes the application (first-time setup) or reboots the system

Describe the bug
The addition of the character device either crashes the application (during first setup and superuser request), or causes a system reboot.

To Reproduce
Steps to reproduce the behavior:
Enable the character device

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Device details (please complete the following information):

  • Device: [e.g. Google Pixel 5] Realme 8
  • OS: [e.g. Android 12, LineageOS 19] Android 13, Custom ROM AfterLife 6.0
  • Soft Keyboard: [e.g. Hacker's Keyboard] Gboard
  • Are You Rooted? [Yes/No] Yes
  • Root Method: [e.g. Magisk] Magisk

Additional context
Add any other context about the problem here.

App doesn't work

Describe the bug
Hello, the app always says "device not connected" (even tho it is) and when exporting debug log it says "error getting logs". The app didn't manage to make the phone a HID device so I used "USB gadget tool" (which I like to use more). No keys are being sent to the pc

To Reproduce
Steps to reproduce the behavior:

  1. Open app
  2. Try anything
  3. See error

Expected behavior
The app should work as intended; be a keyboard app

Screenshots
It's only showing the built in error messages

Device details (please complete the following information):

  • Device: Google Pixel 8 Pro
  • OS: Android 14 QPR2 (March update)
  • Soft Keyboard: Gboard
  • Are You Rooted? Yes
  • Root Method: Magisk 27.0

Additional context
Keyboard emulation works on "Rucky" (a app for running ducky scripts)

I love the idea and I'm so happy someone did it because the old app "USB keyboard" doesn't work (Pixel 8 Pro has no 32bit support)

Volume button passthrough doesn't work

I think it may be a problem with my HID gadget descriptor, because even raw echo commands sent through a root shell aren't working to increase the volume of the connected device. Media keys aren't working either.

Caps lock doesn't work on Gboard in Direct Input

Gboard doesn't send a shift KeyEvent with each key, and KeyEvent.isCapsLockOn() returns false even when caps lock is on, so I can't detect caps lock being on.

Hacker's keyboard works fine though, since it sends a distinct shift KeyEvent with each key when caps lock is enabled.

Shizuku support possible?

Hi! I always dreamed of an app like this, but sadly can't root my phone.

Is this app able to function with ADB permissions? If so, it'd be amazing to see shizuku support implemented.

Notify user when existing character device is not configured as expected (might've been created by some other app) and prompt to fix it

From @404LiverNotFound in this comment

Describe the bug
v1.0.0-beta.4 works well, but every key is sent with l_ctrl key pressed in v1.0.0.

Device details (please complete the following information):

  • Device: ?
  • OS: ?
  • Soft Keyboard: Hacker's Keyboard and Gboard exhibit the same behavior

Logs (from wev)
Input: A

Logs:

[14:     wl_keyboard] key: serial: 5965; time: 2827541; key: 37; state: 1 (pressed)
                    sym: Control_L    (65507), utf8: ''
[14:     wl_keyboard] modifiers: serial: 0; group: 16
                    depressed: 00000004: Control 
                    latched: 00000000
                    locked: 00000010: Mod2 
[14:     wl_keyboard] key: serial: 5967; time: 2827541; key: 38; state: 1 (pressed)
                    sym: a            (97), utf8: ''
[14:     wl_keyboard] key: serial: 5968; time: 2827541; key: 37; state: 0 (released)
                    sym: Control_L    (65507), utf8: ''
[14:     wl_keyboard] modifiers: serial: 0; group: 16
                    depressed: 00000000
                    latched: 00000000
                    locked: 00000010: Mod2 
[14:     wl_keyboard] key: serial: 5970; time: 2827541; key: 38; state: 0 (released)
                    sym: a            (97), utf8: ''
[14:     wl_keyboard] key: serial: 5971; time: 2827542; key: 37; state: 1 (pressed)
                    sym: Control_L    (65507), utf8: ''
[14:     wl_keyboard] modifiers: serial: 0; group: 16
                    depressed: 00000004: Control 
                    latched: 00000000
                    locked: 00000010: Mod2 
[14:     wl_keyboard] key: serial: 5973; time: 2827544; key: 37; state: 0 (released)
                    sym: Control_L    (65507), utf8: ''
[14:     wl_keyboard] modifiers: serial: 0; group: 16
                    depressed: 00000000
                    latched: 00000000
                    locked: 00000010: Mod2

Alternative keyboard layouts

Is your feature request related to a problem? Please describe.
So. A lot of people are going to use this on non-english keyboards, myself included. Maybe, it would be a good idea to add some kind of character→keycode handler for non-QWERTY layouts? Perhaps, files from Linux's keyboard layouts folder (/usr/share/kbd/keymaps/i386/)?

Describe the solution you'd like
Ideally, this should be something like a setting that allows you to pick your used keyboard layouts, a quick switcher in the input activity to pick which layout you are currently using, and maybe an option to handle all layouts simultaneously for when they do not conflict with each other (say, english qwerty and russian йцукен)? So, pressing Л would send the k keyevent, as that is the key that corresponds to Л on the Russian layout.

Describe alternatives you've considered
I've tried using Hackers Keyboard with explicitly drawn russian chars. It was a pain to handle.

Additional context

Support for simple scripting language

Is your feature request related to a problem? Please describe.
If I want to input a set of series of keys at once (including key combos with CTRL or WIN), I cannot use the Manual Input field as it does not support special keyboard characters like SHIFT or CTRL. I can do it via Direct Input with a keyboard like Unexpected Keyboard, but then my input is in real-time and everything is not executed at once.

Describe the solution you'd like
A simple scripting language would both solve the issue I mentioned above and also allow you to use characters that are not present even on keyboards,, like Unexpeected or Hacker.
The scripting language could let you use character codes as well as plain text to specify exactly what you would like to input. On top of that, additional functions like delay() could be implemented. What I had in mind was similar to DuckyScript but obviously more superficial.

App doesn't open in v2.0.0 and V2.1.0

Describe the bug
I try to open the application, but it doesn't open :/

To Reproduce
Steps to reproduce the behavior:

  1. Install the app
  2. Click on the app icon
  3. The app doesn't open
  4. If you try too many times, the standard Android error message appears.

Expected behavior
The application is expected to open normally

Screenshots
I believe there is no need to add screenshots, But if you need it I'll add it later

Device details:

  • Device: Motorola moto G9 Play
  • OS: Stock Android 11
  • Soft Keyboard: Hacker's Keyboard and google keyboard
  • Are You Rooted? Yes
  • Root Method: Magisk 26.3

Additional context
Version V1.1.0 works normally on my device.

So far the app has been wonderful for me, it saved me a lot of trouble with my PC! I can't wait to get started on these new updates with the addition of the Mouse function

If you need help translating, I can help by translating into Brazilian Portuguese(pt-br)

Thanks for the app so far

Character device creation failure on Android 8.0.0 Motorola device

Describe the bug
ERROR: failed to create character device

Device details (please complete the following information):

  • Device: Motorola ???
  • OS: Stock Android 8.0
  • Root Method: Magisk

Additional context (From #26)

I installed USB gadget tool and took the screenshot
I also copied the log, in case it can help

image

log ROOT - Execute command: for dir in /config/usb_gadget/*/; do echo GADGET_PATH=$dir; cd $dir/configs/; echo CONFIG_PATH="$dir/configs/`ls -1 | head -1`/"; cd $dir; if [ "$?" -ne "0" ]; then echo "Error - not able to change dir to $dir... exit"; exit 1; fi; echo UDC=$(cat UDC); find ./configs/ -type l -exec sh -c 'echo FUNCTIONS_ACTIVE=$(basename $(readlink "$@"))' _ {} \;; for f in ./functions/*/; do echo FUNCTIONS=$(basename $f); done; cd ./strings/0x409/; for vars in *; do echo ${vars}=$(cat $vars); done; echo "============="; done;

ROOT (stdout) - GADGET_PATH=/config/usb_gadget//
CONFIG_PATH=/config/usb_gadget/
//configs/acct/
Error - not able to change dir to /config/usb_gadget/*/... exit

ROOT (stderr) - : [1]: cd: /config/usb_gadget//configs: No such file or directory
: [1]: cd: /config/usb_gadget/
: No such file or directory
root - length=1; index=1
ROOT - Execute command: echo KERNEL_VERSION=(uname -r |cut -d '-' -f1 ) && (gunzip -c /proc/config.gz | grep -i configfs | sed 's/# //; s/ is not set/=NOT_SET/')

ROOT (stdout) - KERNEL_VERSION=3.18.71

ROOT (stderr) - : [1]: gunzip: not found
ROOT - Execute command: for dir in /config/usb_gadget//; do echo GADGET_PATH=$dir; cd $dir/configs/; echo CONFIG_PATH="$dir/configs/ls -1 | head -1/"; cd $dir; if [ "$?" -ne "0" ]; then echo "Error - not able to change dir to $dir... exit"; exit 1; fi; echo UDC=$(cat UDC); find ./configs/ -type l -exec sh -c 'echo FUNCTIONS_ACTIVE=$(basename $(readlink "$@"))' _ {} ;; for f in ./functions//; do echo FUNCTIONS=$(basename $f); done; cd ./strings/0x409/; for vars in *; do echo ${vars}=$(cat $vars); done; echo "============="; done;

ROOT (stdout) - GADGET_PATH=/config/usb_gadget//
CONFIG_PATH=/config/usb_gadget/
//configs/acct/
Error - not able to change dir to /config/usb_gadget/*/... exit

ROOT (stderr) - : [1]: cd: /config/usb_gadget//configs: No such file or directory
: [1]: cd: /config/usb_gadget/
: No such file or directory
root - length=1; index=1
ROOT - Execute command: for dir in /config/usb_gadget//; do echo GADGET_PATH=$dir; cd $dir/configs/; echo CONFIG_PATH="$dir/configs/ls -1 | head -1/"; cd $dir; if [ "$?" -ne "0" ]; then echo "Error - not able to change dir to $dir... exit"; exit 1; fi; echo UDC=$(cat UDC); find ./configs/ -type l -exec sh -c 'echo FUNCTIONS_ACTIVE=$(basename $(readlink "$@"))' _ {} ;; for f in ./functions//; do echo FUNCTIONS=$(basename $f); done; cd ./strings/0x409/; for vars in *; do echo ${vars}=$(cat $vars); done; echo "============="; done;

ROOT (stdout) - GADGET_PATH=/config/usb_gadget/g2/
CONFIG_PATH=/config/usb_gadget/g2//configs//
UDC=
FUNCTIONS=*
UDC=
bDeviceClass=0x00
bDeviceProtocol=0x00
bDeviceSubClass=0x00
bMaxPacketSize0=0x00
bcdDevice=0x0318
bcdUSB=0x0000
configs=
functions=
idProduct=0x0000
idVendor=0x0000
os_desc=
strings=

=============

ROOT (stderr) - : [1]: cd: /config/usb_gadget/g2/strings/0x409: No such file or directory
cat: configs: Is a directory
cat: functions: Is a directory
cat: os_desc: Is a directory
cat: strings: Is a directory

Originally posted by @wokawoka in #26 (comment)

Either stop relying on EditText for reading visible character input or change code to reduce the number of issues I have with it

Current situation:
The user focuses an EditText (Labeled "Direct Input") and types into it. A textwatcher compares changes between the contents of the EditText after each change in the text and sends it. The intended use is for the user to keep typing characters without ever tapping on the EditText to move their cursor, as that would mess up the output.

Current issues with this:

  • As stated before, if the user taps the EditText, moving their cursor in that method, it messes everything up
  • It's kinda ugly just to have random characters there in that EditText as the user types
  • There have been some issues with the EditText accidentally consuming input, leading to bugs
  • I can't just clear the EditText after each input because that's expensive and must be run on the main thread, leading to dropped keys if the user types quickly

Proposed solutions:

  1. Create a custom view that just doesn't display characters that are typed. This might also allow all the input to go straight to the onKeyDown method and consolidate the code that handles input.
  2. Add some code using cursor position to get around the (currently) only known remaining issue with the EditText consuming input that I need to process. This happens when the user presses an arrow key that moves the cursor into text within the EditText, not allowing the onKeyDown function to process it, while also not modifying text, so the textwatcher doesn't pick it up either.

versioning issue

The APK at the latest release (v1.1.0) identifies as

package: name='me.arianb.usb_hid_client' versionCode='1' versionName='1.0'

Looks like you forgot to update that in build.gradle. Hard to tell the versions apart then 😉 Can you please keep them "in sync"? versionCode should simply be increased with each new release (Android uses that internally to tell versions apart and to decide whether an APK is an update for the installed app), versionName should ideally match the tag/release name.

Thanks in advance!

Character device permissions don't get properly set automatically on creation for some reason

Current process:

  1. enable HID functions
  2. try to use touchpad
  3. click snackbar button to fix mouse char device permissions
  4. try to use keyboard
  5. click snackbar button to fix keyboard char device permissions

too many steps. It SHOULD be automatic. my hunch is that the creation of the device takes a second or something, causing my automatic permission fixes to not apply, since they'll run before the devices exist, but I should confirm that sometime.

Add option to silently create HID character device after first prompt

Situation:
Character device doesn't exist

Current fix:
User is shown a prompt on app startup if its missing (yes = create it, no = ignore)

Proposed fix:
Same prompt, but add a checkbox to the side that let's the user allow the app to just handle the issue silently after being prompted for the first time

Add mouse support

Make a little square in the app that the user can use like a touchpad

Improve the performance of the sending of each HID report

The current implementation uses su -c with echo to send the report, however, su causes a significant performance hit, and when sending many keys back to back, it really shows.

Possible solutions:

  • Multithread the sending of keys (but in this case, I'd need to figure out how to guarantee the order of the keys)
  • Use root once to give the app's user access to /dev/hidg0, then I won't be restricted to shell commands using su (Not sure how to achieve this, spent some time looking into it and got nowhere)
  • Use a single su process and use that elevated shell to send all echo commands (only issue is that it feels a little messy and gracefully handling key timeouts may be impossible, feels like a bad solution, but the most likely for me to be able to get working)

Refactor UI code to make use of Compose and Material 3

WIP on a branch that isn't pushed yet. Still learning Compose, so I want the code to at least not be horrible and have to be entirely re-written later after I push it.

My goal in doing this is to improve UI consistency, maintainability, and prettiness. I'll make sure Material You is an optional setting since not everyone likes it (depending on the app, sometimes I don't either).

Versions after 1.0.0+ don't work on Surface Duo [Android 12]; pull request might be proposed soon.

Describe the bug
I use a Surface Duo 1. The last working version for me is 1.0.0.

To Reproduce
Steps to reproduce the behavior:

  1. Before I launch the app, I use USB Gadget Tool and create hid.keyboard and hid.mouse functions on Gadget path /config/usb_gadget/g2/.
    /config/usb_gadget/g2/ points to a Gadget with no functions pre-defined and is second on the list when you launch USB Gadget Tool.

  2. I open your USB HID Client and continue past initial setup.

  3. I receive a popup saying that /dev/hidg0 doesn't exist and accept the program's suggested fixes.

  4. I refresh USB Gadget Tools and discover that there are new functions in the wrong Gadget .../g1/. I still need to clarify this point.

  5. I receiving a popup which says that my character permissions might not be set up properly.

  6. I tap 'FIX'; trace to previous step.

Device details (please complete the following information):

  • Device: Surface Duo 1
  • OS: Android 12
  • Soft Keyboard: SwiftKey
  • Are You Rooted?: Yes
  • Root Method: Magisk

Additional context
Incidentally, there is another simpler program currently in development (Android HID Keyboard). That one works perfectly fine.

IF YOU ARE USING THIS LET ME KNOW AND I'LL (maybe) MAINTAIN IT

I've stopped maintaining this because I just started working on other projects but I noticed a few stars so if anyone is actually using this, let me know.

If people are using this, I'll try to do some actual testing and iron out some kinks that I'm sure I left in the project before I forgot about it.

update (10/06/2023): just to add an update for anyone who reads this. I haven't forgot about this, I still plan to do some cleanup and maintenance. I've just been a bit busy w classes. if anyone else reads this feel free to let me know about more bugs or feature requests!

update (3/24/2024): definitely took longer than I meant to for me to get back to this but I've been making improvements during the past week and have just committed some significant improvements. Will release them once it's more polished

Send button disappears

Describe the bug
The send button next to the multiline input disappears unless the field itself is two lines high or more.

To Reproduce
Steps to reproduce the behavior:

  1. Open the app
  2. See the issue

Expected behavior
The send button is there anytime I might need it.

Screenshots
изображение

Device details (please complete the following information):

  • Device: Redmi Note 9S
  • OS: Android 14 (GhostOS)
  • Soft Keyboard: GBoard
  • Are You Rooted? Yes
  • Root Method: Magisk

Additional context
wm size: 1080x2400
wm density: 378

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.