Date: Tue, 08 Nov 2005 10:00:59 +0300 From: Vladimir Grebenschikov <vova@fbsd.ru> To: Maksim Yevmenkin <maksim.yevmenkin@savvis.net> Cc: freebsd-bluetooth@freebsd.org Subject: Re: [RFC] rc.d integration for the bluetooth subsystem Message-ID: <1131433259.1164.7.camel@localhost> In-Reply-To: <4353DBBC.2000508@savvis.net> References: <43519460.1090605@ebs.gr> <1129491219.1616.18.camel@localhost> <4353DBBC.2000508@savvis.net>
next in thread | previous in thread | raw e-mail | index | archive | help
=F7 =D0=CE, 17/10/2005 =D7 10:13 -0700, Maksim Yevmenkin =D0=C9=DB=C5=D4: > Panagiotis, >=20 > it appears i have missed your original email :( not a big problem - i > have found it in the archive. please read my comments inline. >=20 > >> I've been playing with integrating the bluetooth subsystem into our > >> rc.d infrastructure and I'd like to submit the results of my > >> efforts for review. My testing has been centered around my USB > >> bluetooth dongle and I know that it works, but I suppose other > >> bluetooth devices should work as well. I have taken the existing > >> rc.bluetooth script (that is not installed by default) and > >> converted it to rc.d, renaming it as 'bluetooth'. I also added a > >> couple of other scripts for hcsecd and sdpd, that are started from > >> bluetooth, but can also function independently, id so desired. > >> Finally I have added a devd configuration file that makes sure the > >> bluetooth script gets started on insertion and removal of the USB > >> dongle. >=20 > that is great. thanks for doing the work! it seems we have been working=20 > on this in parallel :) about a week ago i have committed (into -current)=20 > hcsecd(8) and sdpd(8) rc.d scripts. they are very similar to what you=20 > have done. please see >=20 > http://www.freebsd.org/cgi/cvsweb.cgi/src/etc/rc.d/hcsecd >=20 > http://www.freebsd.org/cgi/cvsweb.cgi/src/etc/rc.d/sdpd >=20 > http://www.freebsd.org/cgi/cvsweb.cgi/src/etc/defaults/rc.conf >=20 > for more details. >=20 > >> With these changes, when I plug in my USB bluetooth dongle, all the > >> necessary initialization happens behind the scenes and I can start > >> using my bluetooth peripherals right away. When I unplug the dongle > >> all the services stop and the necessary shutdown operations are > >> performed on the bluetooth stack. There is still some work left, > >> like specifying different flags for sdpd & hcsecd, but the defaults > >> work fine. >=20 > that sounds just fine. once again - do not worry about hcsecd(8) and=20 > sdpd(8) scripts anymore - they are done. >=20 > >> In order to test this stuff you have to: > >>=20 > >> - copy bluetooth, hcsecd and sdpd into /etc/rc.d - copy ubt.conf > >> into /usr/local/etc/devd (creating it if necessary), or add its > >> contents to /etc/devd.conf - add a line in /etc/rc.conf with:=20 > >> bluetooth_enable=3D"YES" > >>=20 > >> In an eventual merge into the base system the devd configuration > >> should be merged into /etc/devd.conf and /etc/defaults/rc.conf > >> should contain the following line instead: bluetooth_enable=3D"NO" > >>=20 > >> I'd appreciate any comments you may have. >=20 > devd(8) configuration (ubt.conf) looks fine. i can merge this info=20 > devd.conf for you. hcsecd(8) and sdpd(8) already committed into=20 > -current. i have also created bluetooth section in the=20 > /etc/defaults/rc.conf file. >=20 > i have few comments about my original rc.bluetooth script. >=20 > 1) it probably should not load any kernel modules. the problem is that=20 > when one (or more) bluetooth kernel modules compiled into the kernel the=20 > kldstat(8) check may fail. this has to do with the way kldstat(8) prints=20 > the results and the way rc.bluetooth grep's through them. >=20 > 2) original rc.bluetooth is very rigid. things like device name, device=20 > class, etc. are hardwired into the script. so i'd like to have a bit of=20 > flexibility here, i.e. ability to specify per device >=20 > - device name (change_local_name) >=20 > - device class (write_class_of_device) >=20 > - should device be "visible"/discoverable by default (write_scan_enable) >=20 > - should device request authentication (write_authentication_enable) >=20 > - should device use encryption (write_encryption_enable) >=20 > - should device request role switch (write_node_role_switch) >=20 > and maybe few others. >=20 > 3) i'd like to have some way to execute a few hccontrol(8) commands=20 > after default setup was done. perhaps this could be done with some sort=20 > of bluetooth.local rc.d script that will be executed after main script.=20 > by default it should be empty. another way to do it is to have something=20 > along the bluetooth_extra_commands variable in rc.conf. >=20 > > Great ! It just works, Thank you. > >=20 > > I've added bthidd script (in attachment) to start human interface > > daemon (bt mouse in my case). After recent upgrade of 7-CURRENT I have do not working bthidd. Something bad on boot here. bthidd just not started or failed on boot. If I just turn off and then turn on USB bt dongle - it starts work. No any related messages in /var/log/messages. I have=20 bluetooth_enable=3D"YES" bthidd_enable=3D"YES" in /etc/rc.conf and=20 % cat /usr/local/etc/devd/ubt.conf=20 # When a USB Bluetooth dongle appears, start the bluetooth subsystem. attach 100 { device-name "ubt[0-9]+"; action "/etc/rc.d/bluetooth start $device-name"; }; detach 100 { device-name "ubt[0-9]+"; action "/etc/rc.d/bluetooth stop $device-name"; }; % Does anybody has working on boot bthidd with recent scripts ?=20 > thanks, > max --=20 Vladimir B. Grebenschikov vova@fbsd.ru
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1131433259.1164.7.camel>