bluez udev rules for pcmcia devices
Hi,
I think we should discuss udev rules for bluez (WRT pcmcia cards) as pointed out by Marcel while discussing debian bug #378839.
So far there's a rules file here:
http://bugs.debian.org/cgi-bin/bugreport.cgi/bluez-pcmcia-support.rules?bug=378839;msg=72;att=1
and the bluetooth.sh script here:
http://bugs.debian.org/cgi-bin/bugreport.cgi/bluetooth.sh?bug=378839;msg=72;att=2
both borrowed in the wild (from SuSE IIRC). See the full bug log for further discussion. I basically agree with Marcel because while the bluetooth.sh script is invoked /usr might not be mounted yet thus it should not try to execute /etc/init.d/bluetooth.
comments/ideas?
filippo
--
Filippo Giunchedi - http://esaurito.net
PGP key: 0x6B79D401
random quote follows:
I worked myself up from nothing to a state of extreme poverty. -- Groucho Marx
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Marcel Holtmann
maintainerHi Filippo,
Quoted 10 lines
I think we should discuss udev rules for bluez (WRT pcmcia cards) as pointed out by Marcel while discussing debian bug #378839.
So far there's a rules file here:
http://bugs.debian.org/cgi-bin/bugreport.cgi/bluez-pcmcia-support.rules?bug=378839;msg=72;att=1
and thebluetooth.shscript here:
http://bugs.debian.org/cgi-bin/bugreport.cgi/bluetooth.sh?bug=378839;msg=72;att=2
both borrowed in the wild (from SuSE IIRC). See the full bug log for further discussion. I basically agree with Marcel because while thebluetooth.shscript is invoked /usr might not be mounted yet thus it should not try to execute/etc/init.d/bluetooth.
the first thing is that every line for dtl1_cs, bt3c_cs, bluecard_cs, bt950_cs and btuart_cs must be removed. These are not TTY drivers and totally useless lines anyway.
Second is that I prefer to call the script "bluetooth_hciattach" or better maybe "bluetooth_serial", because this is what it is doing. It is not a generic udev helper for Bluetooth. The job is to attach the serial port to the hci_uart driver. We can also strip the "/lib/udev/" prefix and the ".sh" suffix.
Calling /etc/init.d/bluetooth from the script must go away. Either the support for Bluetooth is enabled or not. The udev helper shouldn't care about it at all.
Also the line "DEVICE=echo $DEVNAME|sed -e 's_/dev/__'" in the script is not needed at all, because hciattach can handle full device names without any problems. And in case of some crazy persistent naming rules it is the safer choice.
Quoted 1 line
Quoted 1 line
From a programming perspective, the TYPEID should be moved into
start_serial, because it is its only user.
If this script isn't distributed via bluez-utils, then the script must check if hciattach is installed. Otherwise you will see errors and this might not be what users expect.
And we should actually only call hciattach instances using the specified device. Don't kill something that you didn't start.
Regards
Marcel
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Quoted 10 lines · Marcel Holtmann
the first thing is that every line for
dtl1_cs,bt3c_cs,bluecard_cs,bt950_csandbtuart_csmust be removed. These are not TTY drivers and totally useless lines anyway.Second is that I prefer to call the script "
bluetooth_hciattach" or better maybe "bluetooth_serial", because this is what it is doing. It is not a generic udev helper for Bluetooth. The job is to attach the serial port to thehci_uartdriver. We can also strip the "/lib/udev/" prefix and the ".sh" suffix.
Quoted 8 lines
Calling
/etc/init.d/bluetoothfrom the script must go away. Either the support for Bluetooth is enabled or not. The udev helper shouldn't care about it at all.Also the line "DEVICE=
echo $DEVNAME|sed -e 's_/dev/__'" in the script is not needed at all, because hciattach can handle full device names without any problems. And in case of some crazy persistent naming rules it is the safer choice.
agreed, I've fixed this in
http://svn.debian.org/wsvn/pkg-bluetooth/bluez-utils/trunk/debian/bluetooth_serial?op=file&rev=0&sc=0
and
http://svn.debian.org/wsvn/pkg-bluetooth/bluez-utils/trunk/debian/bluez-pcmcia-support.udev?op=file&rev=0&sc=0
Quoted 3 lines
Quoted 2 lines
From a programming perspective, the TYPEID should be moved into
start_serial, because it is its only user.
I'm failing to understand this :(
Quoted 4 lines
If this script isn't distributed via bluez-utils, then the script must check if hciattach is installed. Otherwise you will see errors and this might not be what users expect.
fixed as well
Quoted 3 lines
And we should actually only call hciattach instances using the specified device. Don't kill something that you didn't start.
agreed but since the script is (supposed to be) invoked only by udev on add/remove pcmcia bt cards, I think we can assume the script is the only user of $DEVNAME.
thanks,
filippo
--
Filippo Giunchedi - http://esaurito.net
PGP key: 0x6B79D401
random quote follows:
Computer Science is no more about computers than astronomy is about telescopes. -- Edsger Dijkstra
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Quoted 5 lines · Filippo Giunchedi
Quoted 3 lines
Quoted 1 line
From a programming perspective, the TYPEID should be moved into
start_serial, because it is its only user.I'm failing to understand this :(
It's been related to my quick-hacked script where I had TYPEID (~MANF_CARD_ID) set outside of start_serial() . You already fixed it.
Kind regards,
Felix
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Marcel Holtmann
maintainerHi Filippo,
Quoted 19 lines
Quoted 10 lines
the first thing is that every line for
dtl1_cs,bt3c_cs,bluecard_cs,bt950_csandbtuart_csmust be removed. These are not TTY drivers and totally useless lines anyway.Second is that I prefer to call the script "
bluetooth_hciattach" or better maybe "bluetooth_serial", because this is what it is doing. It is not a generic udev helper for Bluetooth. The job is to attach the serial port to thehci_uartdriver. We can also strip the "/lib/udev/" prefix and the ".sh" suffix.Quoted 8 lines
Calling
/etc/init.d/bluetoothfrom the script must go away. Either the support for Bluetooth is enabled or not. The udev helper shouldn't care about it at all.Also the line "DEVICE=
echo $DEVNAME|sed -e 's_/dev/__'" in the script is not needed at all, because hciattach can handle full device names without any problems. And in case of some crazy persistent naming rules it is the safer choice.
Quoted 4 lines
agreed, I've fixed this in
http://svn.debian.org/wsvn/pkg-bluetooth/bluez-utils/trunk/debian/bluetooth_serial?op=file&rev=0&sc=0
and
http://svn.debian.org/wsvn/pkg-bluetooth/bluez-utils/trunk/debian/bluez-pcmcia-support.udev?op=file&rev=0&sc=0
looks good.
Quoted 4 lines
Quoted 2 lines
Quoted 1 line
From a programming perspective, the TYPEID should be moved into
start_serial, because it is its only user.I'm failing to understand this :(
You have a generic TYPEID variable that you define at the top of the script. Don't do this until you have to use it for all function. So define it just before you need it. Like in your new version of the script.
Quoted 5 lines
Quoted 3 lines
If this script isn't distributed via bluez-utils, then the script must check if hciattach is installed. Otherwise you will see errors and this might not be what users expect.
fixed as well
In case of stop_serial() you might wanna do the same. If hciattach is not installed then we are not responsible for cleaning up.
Quoted 6 lines
Quoted 2 lines
And we should actually only call hciattach instances using the specified device. Don't kill something that you didn't start.
agreed but since the script is (supposed to be) invoked only by udev on add/remove pcmcia bt cards, I think we can assume the script is the only user of $DEVNAME.
You can't make that assumption.
Regards
Marcel
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel