Hacker News new | ask | show | jobs
by cnvogel 3337 days ago
> I want a non data transferring power plug that can't be used to compromise my machine should a manufacturer opt to do that.

At least in Linux you can disable automatic binding of kernel drivers to devices like so:

    echo 0 >/sys/bus/usb/drivers_autoprobe
You can plug in a keyboard and even though the device is recognized and listed in "lsusb", it's not used as a keyboard (or network device, soundcard, scanner, ...)

    # dmesg
    [ 1017.031703] usb 1-10.4: new low-speed USB device number 8 using xhci_hcd
    # lsusb -s 1:8
    Bus 001 Device 008: ID 046d:c30e Logitech, Inc. UltraX Keyboard (Y-BL49)
I can type on this newly connected keyboard, but no key presses are recorded on the console or on X-windows. My other (also USB) keyboard that had been connected before is still working fine, though.

This can even be done with a different mechanism on a per-bus basis as described in https://www.kernel.org/doc/Documentation/usb/authorization.t...

If I decide to use the 2nd keyboard, I'll manually bind this device to the usb hid driver like so:

    # echo 1-10.4:1.0 > /sys/bus/usb/drivers/usbhid/bind 
(the :1.0 comes from the different functions one single USB device may offer) And from this point on the keyboard works normally.

I have no idea why no one bothered to make a nice gui for this feature (which also works on other busses), or why it's not standard to popup some message-box on other OSs (e.g. Windows) whenever something is plugged in a port, before even trying to load any drivers.

(edit: added 2nd part where I manually bind)

2 comments

>I have no idea why no one bothered to make a nice gui for this feature

Getting off-topic, but this remark can be applied to most aspects of Linux OS's tbh. We developers are too comfortable with the shell on Linux, whereas with it being such a pain on Windows, the devs themselves are more inclined to write small GUIs left and write to solve their problems.

Yes, I know. And it's sad. I'm also not a "gui" person, and couldn't make a useful graphical interface if my life depended on this.

But I'm especially confused as why this hasn't been built into Windows for years, especially considering how many people were e.g. hurt by "Autoplay" in the old days:

    You've plugged in a device that claims to be...
        [ ] a mouse (driver available)
        [ ] a storage device (driver available)
        [X] a soundcard (driver will be downloaded and installed)
    Tick any of the functions you want to activate, or press CANCEL
    if you don't want to activate any functions of this device, e.g.
    because it's a phone you just want to charge from your laptop.
(of course the wording is utter crap, but you might get the idea...)
That's pretty neat. To make it user friendly I guess you'd have to whitelist attached devices during OS install/setup then prompt for others moving forward. Or whitelist keyboards/mice in general but not other devices.