kennyhml / pyinterception

Modern Python port & wrapper for the interception device driver
MIT License
125 stars 26 forks source link

Set_devices does not work with device 0 #26

Closed Tazdraperm closed 10 months ago

Tazdraperm commented 10 months ago

Set_devices does not work with device 0. It happens because keyboard or interception.keyboard evalueates to interception.keyboard if keyboard is 0, since 0 is considered "falsy". So using set_devices(keyboard=0) has in fact no effect.

Proposed solution: interception.keyboard = keyboard if keyboard is not None else interception.keyboard

(same for mouse)

kyranops commented 8 months ago

I can confirm a similar issue. When running my program inside a vm it was not able to auto_capture the native virtual keyboard (Microsoft Hyper-V virtual keyboard). I had to manually force interception.set_capture(keyboard=0) and it works now. However, i did not have to modify the library per the above suggestion.