Created
May 16, 2021 00:11
-
-
Save dglaude/aad3d9e19858b062306b2a514434fd6b to your computer and use it in GitHub Desktop.
Hidden Mouse Jiggler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import board | |
import digitalio | |
import storage | |
import usb_hid | |
from adafruit_hid.mouse import Mouse | |
import usb_cdc | |
#usb_hid.enable(devices=(usb_hid.MOUSE,)) ###AttributeError: 'module' object has no attribute 'MOUSE' | |
switch = digitalio.DigitalInOut(board.SLIDE_SWITCH) | |
switch.direction = digitalio.Direction.INPUT | |
if switch.value: | |
print("Hiding Drive and Serial") | |
# storage.disable_usb_drive() ###RuntimeError: Cannot change USB devices now | |
# usb_cdc.disable() # <= This seems to work | |
else: | |
print("Debug mode") | |
mouse = Mouse(usb_hid.devices) | |
while True: | |
print("Looping") | |
mouse.move(x=20) | |
time.sleep(5) | |
mouse.move(x=-20) | |
time.sleep(5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As mentioned, you need to put
usb_hid.enable(devices=(usb_hid.Device.MOUSE,))
andstorage.disable_usb_drive()
inboot.py
. By the time you get tocode.py
, the USB devices are set already.And it is
usb_hid.Device.MOUSE
. That should work.I will be writing a guide soon.