1

I have an RFID reader that works as a Keyboard, so, if I click on a Text Entry and put a card near the reader, it puts the content read on the text entry. The latest RFID reader I was using works via serial connection, so I can open and close the connection to avoid fake positives, but with this new model, I can't do that, so I need to disable and enable the device without unplug it from the USB, just like if I do from the Windows Device Manager.

I have tried with pyusb but, in Windows, it doesn't display nothing, (I have tried the same on my RPi 3 and it works properly, but I don't know if I could disable the port).

By the way, I also tried with infi.devicemanager but this only list all peripherals connected and doesn't let me disable/enable it.

Is there any way to do this, like edit the registry, or acess it via cmd prompt.

Thanks!

1 Answers1

2

There is command line tool for this called DevCon. You can disable devices using devcon-disable command. It's supported by Microsoft and since it's a command line tool you can use it programmatically. Here is an example.

can
  • 444
  • 6
  • 14
  • 1
    I have already tried using DevCon, despite that I need the administrator privileges to run the command, which the user who would run my app doesn't have, DevCon doesn't disable the device, and, I have gone one step forward, and I tried to disable the device via the Device Manager's GUI and I check that it stills working. However, I only tried to disable by ID, and I don't know if the syntax was correct, but, just as I said before, I have tried disabling with the GUI and stills working. – David González Blazman Apr 11 '19 at 10:53