Comments (14)
My workaround is to catch the error for every event.
try:
kbd.press(key)
except OSError:
This prevents the RP2040 from crashing while the PC is asleep with the downside of not waking the PC.
from adafruit_circuitpython_hid.
Try inserting a delay of a few seconds before creating the Keyboard()
object. Internally, the constructor has a delay: it tries once, and if that fails, it tries again, after waiting one second, but that may not be enough.
Adafruit_CircuitPython_HID/adafruit_hid/keyboard.py
Lines 65 to 71 in b0c9fb0
from adafruit_circuitpython_hid.
I see whats going on.
I also see now that this was mentioned in #93 and #15
Would it be possible to put this try/except statement in a while loop and break if it succeeds?
from adafruit_circuitpython_hid.
So I've done some tests on my side, and found some interesting results...
I was intent on solving the issue at the root, so I downloaded the source and downloaded mpy-cross and made the edit I suggested in the previous comment, and still nothing changed.
After some trial and error with that, I decided to just do what you said and add a sleep(10)
before I initialize the keyboard, and yet the issue persists. I do believe that still putting the while loop may fix this issue in some instances, however I do not believe that is the issue here.
from adafruit_circuitpython_hid.
Yes, this could be a Windows sleep issue, somehow we are not recovering properly from that. I feel it also used to work for me (I have a Trinket M0 connected as a volume control), and sometimes I see problems now, but it's on Linux. I will try some experiments on Windows.
from adafruit_circuitpython_hid.
Interesting. During my testing on my mac and windows machine i found that the issue would happen on windows both when I tell it to sleep from the power menu, or if it goes to sleep from being idle, whereas i was unable to replicate the issue on my M1 MacBook Air.
from adafruit_circuitpython_hid.
This is also happening to me with a KB2040 with CircuitPython on a MacBook Pro. I built the keyboard as a Split keyboard, with two KB2040 connected with a TRRS cable.
I will try to experiment as well on a fix!
from adafruit_circuitpython_hid.
@isacben any ideas? Have been AFK for a while, but looking to resolve this issue
from adafruit_circuitpython_hid.
I have the same issue with a RP2040 as a custom USB keyboard controller. The keyboard will wake the PC from sleep, but then stops working and additionally hangs the computer for a while or gives a BSOD (driver power state failure or DPC watchdog violation). If I unplug the RP2040 device before putting the PC to sleep I have no issues.
CircuitPython 7.3.2, Windows 11
from adafruit_circuitpython_hid.
Aren't there any fixes/workarounds yet? I'm having the same problem.
from adafruit_circuitpython_hid.
My workaround is to catch the error for every event.
try:
kbd.press(key)
except OSError:
This prevents the RP2040 from crashing while the PC is asleep with the downside of not waking the PC.
Thank you, that did work perfectly.
from adafruit_circuitpython_hid.
My workaround is to catch the error for every event.
try:
kbd.press(key)
except OSError:
This prevents the RP2040 from crashing while the PC is asleep with the downside of not waking the PC.
Thanks for the solution. I am having the same problem but before applying the code the rp2040 wasn't able to wake up the PC. were you able to wake up your PC sending the keyboard.press before caching the error?
from adafruit_circuitpython_hid.
Thanks for the solution. I am having the same problem but before applying the code the rp2040 wasn't able to wake up the PC. were you able to wake up your PC sending the keyboard.press before caching the error?
It would wake the PC some of the time, but then often hang Windows with a BSOD, and the RP2040 would require a reboot.
from adafruit_circuitpython_hid.
We have an open issue for this: it's something to do in the CircuitPython core: adafruit/circuitpython#5380
from adafruit_circuitpython_hid.
Related Issues (20)
- ImportError: no module named '__future__' HOT 6
- Control Codes in keyboard_layout_us not supported HOT 4
- Examples using the keypad module for a keyboard and macros HOT 6
- Pico + keyboard + output to monochrome 20x4 LCD?
- Consumer Control not working HOT 3
- Support for zoom in/out
- adafruit_hid.keyboard.Keyboard.led_on only returns True once only HOT 2
- Keyboard press delay
- Generic HID device support HOT 29
- usb_hid behaviour at boot.. HOT 28
- Implement HID LampArray Support HOT 2
- BLE Keyboard Functionality Issue HOT 3
- BLE Keyboard Functionality Issue on EFR32xG24 Explorer Kit HOT 1
- Gamecontroller setup under mac HOT 7
- Add support for "Pan" or "Horizontal" wheel movement as well as Back/Forward Buttons
- `find_device` module missing in `adafruit_hid.keyboard.Keyboard` HOT 6
- Double key in Discord shortcuts HOT 2
- Possible error in Mouse movement library. HOT 2
- Control the speed of layout.write()? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from adafruit_circuitpython_hid.