Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Jan 2019 12:35:12 +0100
From:      Matthias Apitz <guru@unixarea.de>
To:        Hans Petter Selasky <hps@selasky.org>
Cc:        freebsd-usb@freebsd.org
Subject:   Re: r342378: usbconfig takes 3-5 minutes to read the bus
Message-ID:  <20190103113512.GA2547@c720-r342378>
In-Reply-To: <076e01a2-51e7-b140-28c9-1c58d034327b@selasky.org>
References:  <3ac801b2-899a-ee09-1398-ecab6ec7130a@selasky.org> <20190102104853.GA2622@c720-r342378> <4bf80067-8e3a-572f-c1b5-ae83b1c40c22@selasky.org> <20190102154701.GA13702@c720-r342378> <2f013cf9-b073-04fd-9932-079f86fa24b1@selasky.org> <d0f569af-342f-dac8-8f6d-4fc0ff21924e@selasky.org> <20190103060431.GA2711@c720-r342378> <5950d771-ffa9-9325-b102-295fd092052e@selasky.org> <20190103094850.GA2595@c720-r342378> <076e01a2-51e7-b140-28c9-1c58d034327b@selasky.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--pWyiEgJYm5f9v55/
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

El d=C3=ADa jueves, enero 03, 2019 a las 11:03:26a. m. +0100, Hans Petter S=
elasky escribi=C3=B3:

> 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?
>=20
> Hi,
>=20
> You can add a print in the kernel sys/dev/usb/usb_generic.c in the functi=
on:
>=20
> static int
> ugen_open(struct usb_fifo *f, int fflags)
>=20
>=20
> printf("USB opened by PID %d %s\n", curthread->td_proc->p_pid,=20
> 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=20

$ dmesg | grep PID
=2E..
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: $subs=
ystem";=20
	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";=20
	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: $subs=
ystem";=20
	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";=20
	action "logger killall  pcscd";
	action "killall  pcscd";
};

--=20
Matthias Apitz, =E2=9C=89 guru@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.

--pWyiEgJYm5f9v55/
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEXmn7rBYYViyzy/vBR8z35Hb+nREFAlwt820ACgkQR8z35Hb+
nRGQixAAiQlROK9aTQy1MR8nml2qGHQ1uuCpfhUSLH/7kRKP9I5WgM8goQRYZdB0
sfLs80NJ9g02xeUvzUWTBNOfTjldunv17B24EKWdFVsxC6LWN940+G8HfR4O46MM
uH+J93UtL6UnOpXFrlIkTRp1oNIZNMkd4rmPVZtnDdkhF/eMP0ZWtRrIE2U9TLoZ
SO5sBjaKzlwRPGeZPOa52gECX+CqC2sfaj858koHcma4G95NnnpE4Eo704lg3Ys3
NAQvhWHclZxDHVMzJFXMUY38YAl1l5OW0L8wIuAmPx7zc4MGBBAXbgn6MJDC1E44
B3oL6PP+6t2wRPzji22tjzRWBcbLATbbhSJi0CKD2uTSl/j/uKDl7++jz4fdsmuH
7ZDKhppBRTdegX7JHd6ZUWKxxhu/8ODnR4ZC88WcCGb6f3zLgvqOpUUx5g2UMXT3
aavCfoGC0J1REziZKzsjmhqR5SjnUQrBQsuRHM6v8pFZF6sCoSxVlX0AYmuvAx8l
I1vDUjRx7HF0RyV3XoIN6UkS9qDUYY8RTSGW1iFIpGSD0WH8ngws1coGB0LlDI2K
2SlwRL+lvPFVQNF+5O3Px/CRaSctVZ9/uTgjb8TJeGQnwuEa81Da6c4LLvxRZVVe
WZ0j7unUYIolCPsf5j9UOBugVRVFQfvZktZJ8Znp8TtrOOE9wSo=
=7EHq
-----END PGP SIGNATURE-----

--pWyiEgJYm5f9v55/--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190103113512.GA2547>