Comments (11)
I think you're looking for void notify_usb_device_state_change_user(enum usb_device_state usb_device_state)
from qmk_firmware.
Oh that’s nice! Is there any documentation about this?
from qmk_firmware.
Solved by #21777
from qmk_firmware.
@tim-hilt I see you merged my PR into your fork. Is it working ok for you?
from qmk_firmware.
Hi and thanks for your work first and foremost! I did flash my code on three different boards:
- Elite-C based Corne (by splitkb, aurora-line)
- Frood (RPi 2040) based Hillside 46
- Splinky (RPi 2040) based TBK Mini
so I can test some variety like that.
It did work everytime, if I were to plug it directly into one machine. OS detection works and does what I expect. However, if I have it plugged into my USB-C monitor and wake a machine from suspend, then it always runs into OS_UNSURE
.
I still have to test how it behaves if I switch out host machines and keep the keyboard plugged into the KVM. Also note, that I haven't played with OS_DETECTION_DEBOUNCE
or OS_DETECTION_KEYBOARD_RESET
yet. I'll do so and report back though.
If you already know what I could try out next (raising OS_DETECTION_DEBOUNCE
I guess?) Feel free to share your suspicions and I'll try it out.
from qmk_firmware.
So for the TBK Mini, os-detection worked. After switching from Mac to PC, my default layer is now automatically changed.
from qmk_firmware.
from qmk_firmware.
@andrebrait actually I was wrong when I said
So for the TBK Mini, os-detection worked. After switching from Mac to PC, my default layer is now automatically changed.
It did in fact switch, but I think it did, because OS_WIN and OS_UNSURE are handled the same in my code:
so it did at least retrigger, but I'm pretty sure it didn't detect reliably. I started experimenting with OS_DETECTION_DEBOUNCE, but that didn't the behavior, even after bumping it up 1000 ms. So I tried with OS_DETECTION_KEYBOARD_RESET and that finally did the trick.
So I can confirm, that the feature works. However I can't judge whether the fuzzy behavior is because of my KVM or because of the implementation.
from qmk_firmware.
Most likely it's due to the KVM at some point triggering the reinitialization of the USB interface without cutting power to the board, which causes issues with the detection.
I added that flag because my KVM does that when switching machines, but it's weird that yours does it even when plugging the device in for the first time.... Go figure...
You can always enable debugging there and see what comes out, if you want to understand exactly what's up with it.
from qmk_firmware.
On first plug the detection worked. But it didn’t when I kept it plugged into the KVM but switched out host machines. This seems to be consistent with what you were experiencing with your hardware!
from qmk_firmware.
Oh, I had misunderstood then.
Yeah, then it's 100% expected you need the reset flag. KVMs don't typically cut power, which is the only thing that would cause the USB interface to be completely restarted, so you need to reset the board and force the device descriptor to be generated again so the detection can capture the data from the host and try to detect the OS.
Otherwise, it's never triggered again.
At least that's my understanding of it. Likely the nomenclature is not 100% accurate per se.
from qmk_firmware.
Related Issues (20)
- [Bug] Cannot start nix-shell on macOS HOT 3
- Repeat key won't work? HOT 4
- [Bug]=Main HOT 2
- [Bug] unicorne oled `MOD` key not registering after flashing HOT 1
- [Bug] m256wh (Mode Envoy hotswap PCB) KC_CALC and KC_SLEEP stop working after PC wakeup from sleep HOT 21
- [Bug] Fresh setup can't compile kinesis/kint41:default HOT 3
- [Bug] MIDI_ADVANCED pitches are three octaves too high on Planck rev7 HOT 1
- [Bug] UCIS documentation incomplete/incorrect HOT 2
- [Bug] UCIS input not cleared after resolving mnemonic HOT 1
- [Bug] The fan file is not present HOT 2
- [Bug] Audio doesnt work on Nullbits Snap HOT 4
- "undeclared here" errors while trying to compile firmware for handwired keyboard HOT 1
- [Bug] RGB_TOG wont work until on right half of split keyboard until audio is cycled
- [Bug] Failure to Sync RGB State Upon Powering Down PC HOT 2
- Can't perform initial flash of a new MCU (Pro Micro w/ DFU bootloader) using QMK CLI, have to go to Windows or Mac. HOT 3
- [Bug] STM32F401 needs reboot with a powered usb hub when the host is disconnected HOT 3
- [Bug] Tidbit's TRRS doesnt work HOT 6
- Some questions about the capslock lamp and space_fn
- [Bug] "Swap Hands One Shot" cannot be locked like other "One Shot Keys" HOT 1
- [Bug] Keyboard error when rotating encoder(旋转编码器时键盘错误)
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 qmk_firmware.