My kernel version is 4.18.16-300.fc29_x86.I have a scanning gun with USB interface, which can be identified on my computer.What I need to do now is to prohibit the identification of this scanner at the kernel level.My idea is to identify PID and VID and filter them out. But I don’t know how to change it at the kernel level. What should I do? Do you have any ideas?
Udev is user mode, and I want to solve this problem at the kernel level
You could unplug the USB device. This is hardware level, even lower than
No, no, the task requires finding solutions at the kernel level. I want to read the PID and VID of the scanner gun from the kernel and ban them. Is this ok?
OH! So you want to use this device from userspace, and not have the kernel
managing the device? You can do that with udev rules as suggested above, in
fact, you can use the same udev rules to start your software if you like.
No, I’m trying to disable this device at the kernel level and make it unusable on my Fedora system. In other words, it’s a kernel-level modification that makes the computer unrecognizable after inserting a scanning gun.
The udev rule tells the kernel not to trust the device, which completely disables it at the kernel level. That’s pretty much the furthest you’ll be able to easily get.
What’s your use case?
It is used to study Linux kernel and device driver management. This is the task given by the tutor, which requires that the device be unrecognizable at the kernel level.
Is there any other way? Can I filter out the device’s two IDs from the kernel level?
It’s not possible to prevent the kernel from seeing devices on the USB bus.
Even if you were to write a kernel module that takes ownership of the device,
the kernel is still going to see the device. Whether it actually does
something with that device is another story entirely.
Oh, I see.
What should I do? Or can I prevent the kernel from loading a USB driver to make it not work?
Have you tried just asking the instructor? This is definitely a bit odd to answer without knowing some more details… You can block USB storage devices, but that might not work on this because…well, it’s not actually a USB storage device.
Yes, what details do you want to know that I can provide? I can hardly see my teacher. He often travels on business. I couldn’t discuss it with him in time.
Assuming the kernel module used to drive the device isn’t builtin, you could
add it to the blacklist theoretically…
oh，thanks.I’ll study it again.
Ah - my guess is the tutor is looking for blacklisting.
How to modify the kernel and disable it? Do you have any ideas?
You honestly really just have to ask the tutor… Outside of blacklisting a driver (the device will still show up, it just won’t work) or deauthenticating through udev, this isn’t really something that’s easily attainable, and I really think there was just a misunderstanding of the extent that the device needs to be unrecognizable (probably just need to make sure no drivers are picking it up).