-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mouse move to absolute coordinates #1
Comments
Hi @xcarcelle, In the file 'mouse.h', |
Hi @csash7 thanks for your reply and your interest.
|
Dear @csash7 I have been more tests today with Android 8.0 :
|
Dear @xcarcelle , |
Dear @csash7
|
@csash7 : I have made a fork of your repo to push some tests of HID Report for larger movements of mouse and then for absolute test. Will keep you updated. |
@csash7 Yeah, is it normal that 0x02 on mobile doesn't seem to get recognized? But using 0x06 (for relative) works without any issue. I wonder if there is something else needed 🤔 |
I agree this would be super useful, but only if you also get the screen resolution over the BLE interface somehow - I have not figured out how to that (yet), let me know in case this is obvious... |
@street-grease-coder : did you make any progress on your end ? For screen resolution feedback from the host maybe one can use hm-10 ble/spp uart dongle or ssp profile of esp32 board to connect to the host with a dedicated piece of app code ? |
I noticed the mouse interface in micropython allows for easy access of absolute coordinates. I opted to go that route, away from C/C++/ino code, maybe I'm wrong there. It seems to be possible to replace the default HID file to make this work though |
@street-grease-coder : have you already made a test with a board and micropython abs mode ? I would like to use that route to if possible as well. |
no, im my hands tedious to set up with external libraries compared to the Arduino environment. first make sure that the speed is fast enough |
reporting back, micropython library examples are not available as of now for a mouse. Basic functionality is implemented on level of a bluetooth library and mouse library (but the combination is missing). In circuitpython I could also not find easily-accessible example code to achieve this. As it stands, this library seems to be the only feasible way for beginners to setup anything like a mouse or keyboard (at least on an ESP32, which is the platform I develop on atm) |
@csash7 : I have tested this code NicoHood/HID#123 (comment) with an ArduinoMicro and a Android (7.0) device and it looks great with the digitizer HID Report, I am trying to modify this library to use this digitizer with the identifier/touch/coordinates HID Report to have a clean absolute digitizer over BLE mouse. What do you think ? |
CircuitPython has bluetooth HID keyboard and mouse support. Here's a full guide. It's also not terribly difficult to use custom descriptors ... just replace the parameterless Here's some snippets using CircuitPython 8 on a Circuit Playground Express: Expand for code
import board
import keypad
import adafruit_ble
from adafruit_ble.advertising import Advertisement
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
from adafruit_ble.services.standard.hid import HIDService
from adafruit_ble.services.standard.device_info import DeviceInfoService
import adafruit_hid
from adafruit_hid.mouse import Mouse
# from adafruit_hid.keyboard import Keyboard
# This adds a service to the root BLE radio, advertising the device's existence
device_info = DeviceInfoService(
manufacturer="SampleMan",
software_revision=adafruit_ble.__version__,
# model_number: Optional[str] = None,
# serial_number: Optional[str] = None,
# firmware_revision: Optional[str] = None,
# hardware_revision: Optional[str] = None,
# service: Optional[_bleio.Service] = None,
)
# Default HID descriptors expose keyboard, mouse, and a consumer control device
hidService = HIDService()
# initialize Bluetooth (and BLE) radio
ble = adafruit_ble.BLERadio()
# Create the "friendly" wrapper objects for the mouse and keyboard
m = Mouse(hidService.devices)
# k = Keyboard(hidService.devices)
while True:
if ble.connected:
m.release_all()
m.move(x=-8000, y=-8000)
m._send_no_move() # hack to ensure each movement is seen as distinct by certain OS
m.move(x=300, y=100)
m._send_no_move() # hack to ensure each movement is seen as distinct by certain OS
m.press(Mouse.LEFT_BUTTON)
m.move(x=100, y=300)
m._send_no_move() # hack to ensure each movement is seen as distinct by certain OS
m.release(Mouse.LEFT_BUTTON)
sleep(4) From what I could find, Apple (iOS) does not support either USB nor bluetooth digitizer HID input. I wish it did, so please let me know if I'm mistaken. To have accurate absolute positioning without significant hacks would be great! |
…llows a move of half the screen with LOGICAL_MAXIMUM = 0x1027 (10000), reference: csash7/mbed-BLE-Mouse#1 (comment) xcarcelle/mbed-BLE-Mouse@d39d37b
Dear @csash7 thanks for your great project !
Have you thought about adding absolute coordinates to your library with specific HID Descriptor and Report ?
I would be willing to help and test on android/ios. Cheers.
The text was updated successfully, but these errors were encountered: