summaryrefslogtreecommitdiffstats
path: root/hcid
diff options
context:
space:
mode:
Diffstat (limited to 'hcid')
-rw-r--r--hcid/hcid.conf.56
-rw-r--r--hcid/hcid.h3
-rw-r--r--hcid/kword.c1
-rw-r--r--hcid/lexer.l9
-rw-r--r--hcid/main.c2
-rw-r--r--hcid/parser.y14
6 files changed, 29 insertions, 6 deletions
diff --git a/hcid/hcid.conf.5 b/hcid/hcid.conf.5
index 1dad854d..cb5bcfa9 100644
--- a/hcid/hcid.conf.5
+++ b/hcid/hcid.conf.5
@@ -53,6 +53,12 @@ SetMode("off"). \fIdevdown\fP sets the adapter into down state (same what
\fIhciconfig hci0 down\fP does).
.TP
+\fBdeviceid\fP <vendor>:<product>:<version>
+
+This option allows to specify the vendor and product information of the
+Bluetooth device ID service record.
+
+.TP
\fBpasskey\fP "\fIpin\fP"
The default PIN for incoming connections if \fBsecurity\fP has been
diff --git a/hcid/hcid.h b/hcid/hcid.h
index 8983a899..86b21639 100644
--- a/hcid/hcid.h
+++ b/hcid/hcid.h
@@ -76,7 +76,7 @@ struct device_opts {
uint16_t link_mode;
uint16_t link_policy;
uint8_t scan;
- int discovto;
+ uint32_t discovto;
};
extern struct device_opts default_device;
@@ -94,6 +94,7 @@ struct hcid_opts {
int security;
int pairing;
int offmode;
+ char deviceid[15];
char *config_file;
diff --git a/hcid/kword.c b/hcid/kword.c
index 2a51a0b3..7d2c694c 100644
--- a/hcid/kword.c
+++ b/hcid/kword.c
@@ -49,6 +49,7 @@ struct kword cfg_keyword[] = {
{ "security", K_SECURITY },
{ "pairing", K_PAIRING },
{ "offmode", K_OFFMODE },
+ { "deviceid", K_DEVICEID },
{ "pkt_type", K_PTYPE },
{ "lm", K_LM },
{ "lp", K_LP },
diff --git a/hcid/lexer.l b/hcid/lexer.l
index a194f708..f4559494 100644
--- a/hcid/lexer.l
+++ b/hcid/lexer.l
@@ -63,7 +63,9 @@ path (\/{fname})+
string \".*\"
hci hci[0-9]+
hextuple [0-9a-zA-Z][0-9a-zA-Z]
+hexquad {hextuple}{hextuple}
bdaddr {hextuple}:{hextuple}:{hextuple}:{hextuple}:{hextuple}:{hextuple}
+id {hexquad}:{hexquad}
%x OPTION PARAM
@@ -117,7 +119,7 @@ bdaddr {hextuple}:{hextuple}:{hextuple}:{hextuple}:{hextuple}:{hextuple}
}
{string} {
- if(yyleng > sizeof(str_buf) - 1){
+ if (yyleng > sizeof(str_buf) - 1) {
yyerror("string too long");
return 0;
}
@@ -139,6 +141,11 @@ bdaddr {hextuple}:{hextuple}:{hextuple}:{hextuple}:{hextuple}:{hextuple}
return PATH;
}
+{id} {
+ yylval.str = yytext;
+ return ID;
+}
+
. {
return *yytext;
}
diff --git a/hcid/main.c b/hcid/main.c
index 641cc801..943d6cf4 100644
--- a/hcid/main.c
+++ b/hcid/main.c
@@ -783,7 +783,7 @@ int main(int argc, char *argv[])
if (sdp) {
set_sdp_server_enable();
- start_sdp_server(0, SDP_SERVER_COMPAT);
+ start_sdp_server(0, hcid.deviceid, SDP_SERVER_COMPAT);
}
notify_init();
diff --git a/hcid/parser.y b/hcid/parser.y
index aa16a5c7..4641a0ac 100644
--- a/hcid/parser.y
+++ b/hcid/parser.y
@@ -62,16 +62,16 @@ void yylex_destroy(void);
}
%token K_OPTIONS K_DEVICE
-%token K_AUTOINIT K_SECURITY K_PAIRING K_OFFMODE
+%token K_AUTOINIT K_SECURITY K_PAIRING K_OFFMODE K_DEVICEID
%token K_PTYPE K_NAME K_CLASS K_VOICE K_PAGETO K_LM K_LP K_ISCAN K_PSCAN K_DISCOVTO
%token K_PASSKEY
%token K_YES K_NO
-%token <str> WORD PATH STRING LIST HCI BDADDR
+%token <str> WORD PATH STRING LIST HCI BDADDR ID
%token <num> NUM
%type <num> bool pkt_type link_mode link_policy sec_mode pair_mode off_mode
-%type <str> dev_name hci bdaddr
+%type <str> dev_name dev_id hci bdaddr
%%
config: statement | config statement;
@@ -122,6 +122,10 @@ hcid_opt:
hcid.offmode = $2;
}
+ | K_DEVICEID dev_id {
+ strncpy((char *) hcid.deviceid, $2, 15);
+ }
+
| K_PASSKEY STRING {
strncpy((char *) hcid.pin_code, $2, 16);
hcid.pin_len = strlen($2);
@@ -172,6 +176,10 @@ off_mode:
}
;
+dev_id:
+ ID {
+ }
+ ;
device_options: '{' device_opts '}';
device_opts: | device_opt ';' | error ';' | device_opts device_opt ';';