Issue
I am trying to find out USB slave detection interrupt in kernel source code. I am using IMX8MM platform as slave USB device. I want to implement parallel ISR on USB detection interrupt. When USB is connected with host, slave USB driver would have generated some software interrupt. I want to use that interrupt as indication to top user application using custom ISR on it. I can see below interrupt in /proc/interrupt
.
58: 0 0 0 0 GICv3 72 Level 32e40000.usb
Please help me to achieve this.
Solution
Such events should be reported through the kernel's hotplug uevent mechanism. On most Linux systems such hotplug events are processed in userspace through udev. As such, it should be as simple as writing a udev rule, initiating the desired action.
If udev is available on your target platform you can use (as root
) the command
udevadm monitor
to get a live display of hotplug events in realtime. You can use that as a starting point to write an appropriate udev rule.
You most definitely should not attempt to mess with kernel internals and "soft" interrupts here. For one, there is no need to do so. And more importantly, messing with such details in the kernel may cause hard to debug system instabilities.
Answered By - datenwolf Answer Checked By - Robin (WPSolving Admin)