r342378: usbconfig takes 3-5 minutes to read the bus

Matthias Apitz guru at unixarea.de
Thu Jan 3 11:35:18 UTC 2019


El día jueves, enero 03, 2019 a las 11:03:26a. m. +0100, Hans Petter Selasky escribió:

> On 1/3/19 10:48 AM, Matthias Apitz wrote:
> > Is there a way log log any init call to libusb.so to see which process
> > is doing something with libusb.so after devd(8) started pcscd?
> 
> Hi,
> 
> You can add a print in the kernel sys/dev/usb/usb_generic.c in the function:
> 
> static int
> ugen_open(struct usb_fifo *f, int fflags)
> 
> 
> printf("USB opened by PID %d %s\n", curthread->td_proc->p_pid, 
> curthread->td_proc->p_comm);

Hi,

I've added the code and rebooted the new kernel. The only PID requesting
the ugen_open() is PID 544 pcscd, which is 

$ dmesg | grep PID
...
USB opened by PID 544 pcscd
USB opened by PID 544 pcscd
USB opened by PID 544 pcscd
USB opened by PID 544 pcscd
USB opened by PID 544 pcscd
USB opened by PID 544 pcscd


$ ps ax | grep 544
 544 v0- S     0:00,51 /usr/local/sbin/pcscd --debug --foreground

but is doing so 3000++ times:

$ dmesg | grep 'PID 544' | wc -l
    3441

This proc is started by devd(8)  with that devd(8) hook:


notify 1000 {
	match "system" "USB";
	match "subsystem" "INTERFACE";
	match "type" "ATTACH";
	# uTrust
	match "vendor"		"0x04e6";
	match "product"		"0x5816";
	action "logger CCID uTrust, type: $type, system: $system, subsystem: $subsystem"; 
	action "logger /usr/local/sbin/pcscd --debug --foreground ";
	action "nohup /usr/local/sbin/pcscd --debug --foreground &";
};
#
notify 1000 {
	match "system" "USB";
	match "subsystem" "INTERFACE";
	match "type" "ATTACH";
	# HID Omnikey
	match "vendor"		"0x076b";
	match "product"		"0x6632";
	action "logger CCID HID Omnikey, type: $type, system: $system, subsystem: $subsystem"; 
	action "logger /usr/local/sbin/pcscd --debug --foreground ";
	action "nohup /usr/local/sbin/pcscd --debug --foreground & ";
};
#
notify 1000 {
	match "system" "USB";
	match "subsystem" "INTERFACE";
	match "type" "DETACH";
	# uTrust
	match "vendor"		"0x04e6";
	match "product"		"0x5816";
	action "logger CCID uTrust, type: $type, system: $system, subsystem: $subsystem"; 
	action "logger killall  pcscd";
	action "killall  pcscd";
};
#
notify 1000 {
	match "system" "USB";
	match "subsystem" "INTERFACE";
	match "type" "DETACH";
	# HID Omnikey
	match "vendor"		"0x076b";
	match "product"		"0x6632";
	action "logger CCID HID Omnikey, type: $type, system: $system, subsystem: $subsystem"; 
	action "logger killall  pcscd";
	action "killall  pcscd";
};

-- 
Matthias Apitz, ✉ guru at unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub
October, 7 -- The GDR was different: Peace instead of Bundeswehr and wars, Druschba
instead of Nazis, to live instead of to survive.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-usb/attachments/20190103/97c02d2c/attachment.sig>


More information about the freebsd-usb mailing list