let me know the following regarding USB Modem plug

2019-08-10 11:41发布

问题:

Please let me know the following regarding USB Modem plugin & plug out notification handler APIs or system calls in Linux :

In my application I have to write a function which will receive notifications in the following scenarios :

  1. When a USB Modem is plugged in, I would like to receive a notification that a USB Modem is plugged in, any Linux system call or Linux kernel API is there to send these notifications, also along with notification if I receive additional information about that device, network speed, etc, that will be good

  2. When a USB Modem is plugged out, I would like to receive a notification that a USB Modem is plugged out, any Linux system call or Linux kernel API is there to send these notifications, also along with notification if I receive additional information that will be good

Regards

回答1:

Notification of hotplugging of hardware on modern Linux distributions is handled by udev, either via udevd directly or via D-Bus.