From d44690489b57969bfdc44ebfcbfefce6cf3c5b42 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Wed, 1 Oct 2014 12:00:14 +0200 Subject: [PATCH] udev: Don't mark disconnected RFCOMM ttys as candidates Bluetooth serial devices are weird. They begin life being bound with RFCOMMCREATEDEV ioctl() and then move around the sysfs tree when they are connected and disconnected. The connection is estabilished upon the first open() and torn down upon last close(), their first user virtually being "owner" of the connection. We don't want to be that process, we're only interested in actually connected modems. However, currently we have no knowledge of that and therefore we connect and disconnect multiple times while probing. This patch marks unconnected RFCOMM devices as uninteresting to us. The actual connection and disconnection will be handled by NetworkManager. --- src/80-mm-candidate.rules | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/80-mm-candidate.rules b/src/80-mm-candidate.rules index 2e938d7a..52e6882e 100644 --- a/src/80-mm-candidate.rules +++ b/src/80-mm-candidate.rules @@ -9,6 +9,10 @@ ACTION!="add|change|move", GOTO="mm_candidate_end" +# Opening bound but disconnected Bluetooth RFCOMM ttys would initiate the +# connection. Don't do that. +KERNEL=="rfcomm[0-9]*", DEVPATH=="*/virtual/*", GOTO="mm_candidate_end" + SUBSYSTEM=="tty", ENV{ID_MM_CANDIDATE}="1" SUBSYSTEM=="net", ENV{ID_MM_CANDIDATE}="1" KERNEL=="cdc-wdm*", SUBSYSTEM=="usb", ENV{ID_MM_CANDIDATE}="1"