Device specific configuration
Marcel Holtmann
maintainerHi Folks,
this is the patch for the device specific configuration of hcid, that I am going to apply. Comments?
Regards
Marcel
Index: hcid/hcid.h
===================================================================
RCS file: /cvsroot/bluez/utils/hcid/hcid.h,v
retrieving revision 1.6
hcid.h +13 -3
@@ -26,10 +27,10 @@#include <sys/types.h> -#include "glib-ectomy.h" -#include <bluetooth/bluetooth.h> +#include "glib-ectomy.h" +#define HCID_CONFIG_FILE "/etc/bluetooth/hcid.conf"#define HCID_PIN_FILE "/etc/bluetooth/pin"#define HCID_KEY_FILE "/etc/bluetooth/link_key"
@@ -45,7 +46,15 @@uint16_t auth;uint16_t encrypt; }; -extern struct device_opts devi; + +extern struct device_opts default_device; +extern struct device_opts *parser_device; + +struct device_list { +char *ref;/* HCI device or Bluetooth address */ +struct device_list *next; +struct device_opts opts; +};struct link_key {bdaddr_t sba;
@@ -83,6 +92,8 @@#define HCID_PAIRING_ONCE 2int read_config (char *file); + +struct device_opts *alloc_device_opts (char *addr);gboolean io_stack_event (GIOChannel *chan,GIOCondition cond,gpointer data);gboolean io_security_event (GIOChannel *chan,GIOCondition cond,gpointer data);
Index: hcid/lexer.l
===================================================================
RCS file: /cvsroot/bluez/utils/hcid/lexer.l,v
retrieving revision 1.2
lexer.l +13 -0
@@ -52,6 +52,9 @@ fname [A-Za-z0-9\_\.\-]+ path (\/{fname})+ string \".*\" +hci hci[0-9]+ +hextuple [0-9a-zA-Z][0-9a-zA-Z] +bdaddr {hextuple}:{hextuple}:{hextuple}:{hextuple}:{hextuple}:{hextuple} %x OPTION PARAM
@@ -68,6 +71,16 @@ \n { lineno++; +} + +{hci} { + yylval.str = yytext; + return HCI; +} + +{bdaddr} { + yylval.str = yytext; + return BDADDR; } {hex} {
Index: hcid/main.c
===================================================================
RCS file: /cvsroot/bluez/utils/hcid/main.c,v
retrieving revision 1.9
main.c +108 -19
218 lines not on this page · raw message
Index: hcid/parser.y
===================================================================
RCS file: /cvsroot/bluez/utils/hcid/parser.y,v
retrieving revision 1.5
parser.y +45 -17
129 lines not on this page · raw message
Marcel,
tis 2004-02-03 klockan 17.52 skrev Marcel Holtmann:
Quoted 2 lines
this is the patch for the device specific configuration of hcid, that I am going to apply. Comments?
Here's a new draft for the hcid.1 man page. It includes a description of hcid.conf. I propose a few modifications, detailed in the the draft, all possible to make backwards compatible:
1. Device and security settings in the "options" section becomes deprecated and an alias in favour of "device default". These parameters are default unless specified in the "device", "device <hci>" and "device <bdaddr>" sections.
2. "enable" and "disable" becomes deprecated and aliases for "yes" and "no" respectively.
Fredrik
.\"
.\" hcid manual page.
.\" Copyright (C) 2004 Fredrik Noring
.\"
.TH hcid 1
.SH NAME
hcid \- Bluetooth interface daemon
.SH SYNOPSIS
.PP
\fBhcid\fP [\fIoption\fP]...
.SH DESCRIPTION
\fIhcid\fP is the Bluetooth interface daemon. See
http://www.bluez.org/ for more information about Bluetooth for Linux. The main purpose of \fIhcid\fP is to automatically configure Bluetooth interfaces (hci0, hci1 ...).
\fIhcid\fP also provides Bluetooth device pairing services.
.SH OPTIONS
The following options are supported:
.TP
\fB-f\fP=\fIfile\fP, \fB--config-file\fP=\fIfile\fP
Use the given configuration file.
.TP
\fB-h\fP, \fB--help\fP
Print on the standard output a description of the command line options. .TP
\fB-n\fP, \fB--no-daemon\fP
Do not fork as a daemon.
.TP
\fB--version\fP
Print the version of the daemon.
.SH CONFIGURATION FILE
The \fIhcid\fP configuration file is located in \fB/etc/bluetooth/hcid.conf\fP. It consists of sections and parameters. A section begins with the name of the section followed by optional specifiers and the parameters inside curly brackets. Sections contain parameters of the form:
.TP
\fIname\fP \fIvalue1\fP, \fIvalue2\fP ... ;
.PP
Any character after a hash ('#') character is ignored until newline. Whitespace is also ignored.
.SH SECTION DESCRIPTION
Sections can be any number of \fBdevice\fP sections. If no specifier is provided, the parameters are applied to devices that do not match any other section section. The following optional specifiers are supported:
.TP \fInn\fP\fB:\fP\fInn\fP\fB:\fP\fInn\fP\fB:\fP\fInn\fP\fB:\fP\fInn\fP\fB:\fP\fInn\fP
Parameters specified within this section will be applied to the device with this \fIdevice address\fP.
.TP
\fBhci\fIn\fP
Parameters specified within this section will be applied to the device with this \fIdevice interface\fP, unless that device is matched by a \fIdevice address\fP section.
.TP
\fBdefault\fP
Parameters specified within this section will be applied to all device sections where these are unspecified.
.PP
The following parameters may be present in a \fBdevice\fP section\fB:\fP
.TP
\fBautoinit\fP = yes|no
Automatically initialize new devices. The default is \fBno\fP.
.TP
\fBauth\fP = yes|no
.TP
\fBclass\fP = 0x\fIhhh\FP
.TP
\fBencrypt\fP = yes|no
.TP
\fBiscan\fP = yes|no
.TP
\fBlm\fP = none|accept,master
.TP
\fBlp\fP = none|rswitch,hold,sniff,park
.TP
\fBname\fP = "\fIname\fP"
.TP
\fBpairing\fP = none|multi|once
.TP
\fBpin_helper\fP = \fIfile\fP
.TP
\fBpkt_type\fP = DH1,DM1,HV1
.TP
\fBpscan\fP = yes|no
.TP
\fBsecurity\fP = none|auto|user
.SH SIGNALS
.SH EXAMPLE
Example of \fBhcid.conf\fP file:
.nf
# These parameters are applied to all device sections unless
# specified in those sections.
device default {
# Automatically initialize new devices
autoinit yes; # Local device name
# %d - device id
# %h - host name
name "%h";
# Security Manager mode
# none - Security manager disabled
# auto - Use local PIN for incoming connections
# user - Always ask user for a PIN
security auto;
# Pairing mode
# none - Pairing disabled
# multi - Allow pairing with already paired devices
# once - Pair once and deny successive attempts
pairing once;
# PIN helper
pin_helper /bin/bluepin;
# Local device class
class 0x100;
# Default packet type
# pkt_type DH1, DM1, HV1;
# Inquiry and Page scan
iscan yes;
pscan yes;
# Default link mode
# none - no specific policy
# accept - always accept incoming connections
# master - become master on incoming connections,
# deny role switch on outgoing connections
# lm accept, master;
lm accept;
# Default link policy
# none - no specific policy
# rswitch - allow role switch
# hold - allow hold mode
# sniff - allow sniff mode
# park - allow park mode
# lp hold, sniff;
lp hold, sniff, park;
# Authentication and Encryption
# auth yes;
# encrypt yes;
}
# Parameters for a device with address 00:11:22:33:44:55
device 00:11:22:33:44:55 {
encrypt yes;
}# Parameters for all other devices
device {
pairing multi;
}.SH FILES
.nf/etc/bluetooth/hcid.conf/etc/bluetooth/keytab/etc/bluetooth/keytab.shadow
.SH AUTHORS
Written by Fredrik Noring and Maxim Krasnyansky.
.SH BUGS
Please send bug reports to <[email protected]>.
Marcel Holtmann
maintainerHi Fredrik,
Quoted 11 lines
Here's a new draft for the hcid.1 man page. It includes a description of hcid.conf. I propose a few modifications, detailed in the the draft, all possible to make backwards compatible:
1. Device and security settings in the "options" section becomes deprecated and an alias in favour of "device default". These parameters are default unless specified in the "device", "device <hci>" and "device <bdaddr>" sections.
2. "enable" and "disable" becomes deprecated and aliases for "yes" and "no" respectively.
please don't include stuff that I haven't yet applied. The device specific configuration will be applied, but I haven't decided on anything else. BTW did my patch work fine for you?
What patch brings in "device default {..."? We don't need it, because we can use "device {..." for it.
Name the tool "Bluetooth HCI daemon", because interface is to generic.
The mailing list is still "[email protected]" and I don't tend to change it, because the spam stuff of SF is doing a good job.
Regards
Marcel
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Marcel,
tis 2004-02-03 klockan 19.47 skrev Marcel Holtmann:
Quoted 3 lines
please don't include stuff that I haven't yet applied. The device specific configuration will be applied, but I haven't decided on anything else.
The draft was indended for the development version. Btw., I've made my patches available at: http://noring.nocrew.org/bluetooth/
Quoted 1 line
BTW did my patch work fine for you?
Yes, I suppose you mainly changed indentation.
Quoted 2 lines
What patch brings in "device default {..."? We don't need it, because we can use "device {..." for it.
It wasn't the same thing. "device { ... }" is the fallback device. "device default { ... }" was intended to set default parameters for all other device sections unless specified explicitly in those. But we can make that the same thing of course.
Quoted 2 lines
The mailing list is still "[email protected]" and I don't tend to change it, because the spam stuff of SF is doing a good job.
Sorry, that was a spelling mistake.
Fredrik
Marcel Holtmann
maintainerHi Fredrik,
Quoted 3 lines
Quoted 1 line
BTW did my patch work fine for you?
Yes, I suppose you mainly changed indentation.
I also changed some other stuff, because I found it too complex. I need some reports that this patch is working fine and not breaking the normal expected behaviour.
Quoted 7 lines
Quoted 2 lines
What patch brings in "device default {..."? We don't need it, because we can use "device {..." for it.
It wasn't the same thing. "device { ... }" is the fallback device. "device default { ... }" was intended to set default parameters for all other device sections unless specified explicitly in those. But we can make that the same thing of course.
We need only one of them which is default and the <hciX> or <bdaddr> can extend these default settings. Everything else is overload.
Regards
Marcel
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel