public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Alban Browaeys <prahal@yahoo.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH] Add parent dev in rfcomm tty sysfs registration
Date: Mon, 08 Dec 2008 19:57:51 +0100	[thread overview]
Message-ID: <493D6E2F.7000406@yahoo.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1400 bytes --]

This is an attempt at getting the parent device to be bound to the sysfs 
entry of rfcomm tty.
This let hal detect it properly when connecting. No more.

Thus one have to :
$ rfcomm connect 0
after adding his configuration for the device to connect to in 
/etc/bluetooth/rfcomm.conf
One need a patch to hal (for to add the address and channel data to the 
hald/linux/device.c serial handler) and an fdi for  to add the  
capabilities  to get  the serial line to be recognized as a modem by 
NetworkManager.

Maybe it could be achieved at bind. Though this would either requires a 
change to rfcomm to get the sysfs data available at bind and not connect 
or to have hal poll bluez (I don't know yet if udev send event at rfcomm 
bind /dev/rfcommX creation so if polling could be avoided).


Also this does not address the lack of presence of rfcomm tty in 
/sys/devices. This I am too lost in the different device_move to know if 
it is registered in /sys/devices then moved to /sys/class/bluetooth or 
if something is missing for to get the entries in /sys/devices . Tty 
available documentation implying it should be automatic lead me to think 
device_move is the key of this issue.

So it is not a panacea but with this at least it becomes "possible" to 
get something out of hal and with a single script that rfcomm connect to 
get the bluetooth serial device in NetworkManager.

Greetings
Alban

[-- Attachment #2: rfcomm_addparentdev_insysfs_registration.diff --]
[-- Type: text/x-patch, Size: 836 bytes --]

diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
index d3340dd..c553acf 100644
--- a/net/bluetooth/rfcomm/tty.c
+++ b/net/bluetooth/rfcomm/tty.c
@@ -205,6 +205,7 @@ static DEVICE_ATTR(channel, S_IRUGO, show_channel, NULL);
 static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc)
 {
 	struct rfcomm_dev *dev;
+	struct device * hdev;
 	struct list_head *head = &rfcomm_dev_list, *p;
 	int err = 0;
 
@@ -306,7 +307,12 @@ out:
 		return err;
 	}
 
-	dev->tty_dev = tty_register_device(rfcomm_tty_driver, dev->id, NULL);
+	hdev = rfcomm_get_device(dev);
+
+	printk("HDEV : %p", hdev);
+
+	dev->tty_dev = tty_register_device(rfcomm_tty_driver, dev->id, hdev);
+	//dev->tty_dev = tty_register_device(rfcomm_tty_driver, dev->id, NULL);
 
 	if (IS_ERR(dev->tty_dev)) {
 		err = PTR_ERR(dev->tty_dev);

             reply	other threads:[~2008-12-08 18:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-08 18:57 Alban Browaeys [this message]
2008-12-08 19:07 ` [PATCH] Add parent dev in rfcomm tty sysfs registration Marcel Holtmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=493D6E2F.7000406@yahoo.com \
    --to=prahal@yahoo.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox