You can subscribe to this list here.
| 2001 |
Jan
|
Feb
(44) |
Mar
(202) |
Apr
(134) |
May
(89) |
Jun
(94) |
Jul
(58) |
Aug
(58) |
Sep
(56) |
Oct
(75) |
Nov
(26) |
Dec
(14) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2002 |
Jan
(24) |
Feb
(30) |
Mar
(15) |
Apr
(49) |
May
(12) |
Jun
(6) |
Jul
(11) |
Aug
(20) |
Sep
(19) |
Oct
(3) |
Nov
(13) |
Dec
(1) |
| 2003 |
Jan
(7) |
Feb
(4) |
Mar
(7) |
Apr
(5) |
May
(6) |
Jun
(3) |
Jul
(1) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
(51) |
Dec
(1) |
| 2004 |
Jan
(11) |
Feb
(5) |
Mar
|
Apr
(5) |
May
(2) |
Jun
|
Jul
(21) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Anders J. <and...@us...> - 2003-11-17 15:01:30
|
The following files were modified in libs/openbt:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
bt_if.c 1.5 1.6=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
bt_if.h 1.5 1.6=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Added bt_read_ledenable and bt_write_ledenable
The diff of the modified file(s):
--- bt_if.c 2003/11/06 19:12:09 1.5
+++ bt_if.c 2003/11/17 15:00:47 1.6
@@ -1198,6 +1198,30 @@ int bt_write_pin_type(int bt_cfd, int ty
return type;
}
=20
+int bt_read_ledenable(int bt_cfd)
+{
+ int param =3D 0;
+ if (ioctl(bt_cfd, BTLEDSTATUS, ¶m) < 0)
+ {
+ perror(__FUNCTION__);
+ exit(1);
+ }
+
+ return param;
+}
+
+int bt_write_ledenable(int bt_cfd, unsigned char enable)
+{
+ int param =3D enable & 0x0f;
+ param |=3D 0xf0;
+ if (ioctl(bt_cfd, BTLEDSTATUS, ¶m) < 0)
+ {
+ perror(__FUNCTION__);
+ exit(1);
+ }
+ return 0;
+}
+
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
/* Misc functions */
=20
--- bt_if.h 2003/11/06 19:12:09 1.5
+++ bt_if.h 2003/11/17 15:00:48 1.6
@@ -135,6 +135,9 @@
/* Disconnect all connections */
#define BTDISCONNECT_ALL _IO(BT_IOC_MAGIC, 0x14)
=20
+/* Read/Write LED enabled, CRIS-specific */
+#define BTLEDSTATUS _IOW(BT_IOC_MAGIC, 0x15, int)
+
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
/* Ioctls for executing HCI commands */
=20
@@ -406,6 +409,10 @@ void bt_set_local_name(int bt_cfd, const
/* Write / Read pin type */
int bt_write_pin_type(int bt_cfd, int type);
int bt_read_pin_type(int bt_cfd);
+
+/* Read / Write led enable, cris-specific */
+int bt_read_ledenable(int bt_cfd);
+int bt_write_ledenable(int bt_cfd, unsigned char enable);
=20
=20
/*
|
|
From: Anders J. <and...@us...> - 2003-11-17 14:58:38
|
The following file was modified in linux/include/linux/bluetooth: Name Old version New version Tag Comment ---- ----------- ----------- --- ------- btcommon.h 1.103 1.104=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Added IOCTL to enable/disable on-board LED, only for CRIS. The diff of the modified file(s): --- btcommon.h 2003/11/06 19:13:26 1.103 +++ btcommon.h 2003/11/17 14:57:54 1.104 @@ -152,6 +152,7 @@ #define BTREADREMOTENAME _IOWR(BT_IOC_MAGIC, 0x12, u8[BT_NAME_LENGTH]) #define BTREADREMOTECLASSOFDEV _IOWR(BT_IOC_MAGIC, 0x13, u8[6]) #define BTDISCONNECT_ALL _IO(BT_IOC_MAGIC, 0x14) +#define BTLEDSTATUS _IOW(BT_IOC_MAGIC, 0x15, s32) =20 /* Ioctls executing HCI commands */ =20 |
|
From: Anders J. <and...@us...> - 2003-11-17 14:57:36
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
bluetooth.c 1.244 1.245=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Added IOCTL to enable/disable on-board LED, only for CRIS.
The diff of the modified file(s):
--- bluetooth.c 2003/11/12 10:15:05 1.244
+++ bluetooth.c 2003/11/17 14:56:55 1.245
@@ -185,7 +185,7 @@ typedef struct bt_inbuffer
=20
#define NO_BLUETOOTH_ACTIVITY 0
#define BLUETOOTH_ACTIVITY 1
-
+static int ledenable =3D 1;
static struct timer_list bt_clear_led_timer;
static int bt_led_next_time;
static int bt_led_active;
@@ -1661,6 +1661,28 @@ hci_inq_exit0:
break;
}=20=20=20
=20
+ case BTLEDSTATUS:
+ {=20=20=20
+#ifdef __CRIS__
+ u8 enable;
+ u8 writeparam;
+ GET_USER(tmp, (s32*)arg);
+ writeparam =3D (u8)(tmp & 0xf0);
+ enable =3D (u8)(tmp & 0x0f);
+ if(writeparam) {
+ ledenable =3D enable;
+ if(!ledenable)
+ {
+ LED_ACTIVE_SET(LED_OFF);
+ }
+ } else {
+ tmp =3D ledenable;
+ put_user(tmp, (s32*)arg);
+ }
+#endif
+ return 0;=09
+ }
+=09
default:
return -ENOIOCTLCMD;
}
@@ -2708,6 +2730,7 @@ bt_hangupline(s32 line)
static void
bt_clear_led(unsigned long dummy)
{
+=09
if (bt_led_active && jiffies > bt_led_next_time) {
bt_set_leds(NO_BLUETOOTH_ACTIVITY);
=20
@@ -2735,11 +2758,13 @@ bt_flash_led(void)
static void
bt_set_leds(int active)
{
+ if(ledenable) {=09
if ((!hci_ctrl.nbr_of_connections && active =3D=3D BLUETOOTH_ACTIVITY) ||
(hci_ctrl.nbr_of_connections && active =3D=3D NO_BLUETOOTH_ACT=
IVITY)) {
LED_ACTIVE_SET(bt_dfu_mode(-1) ? LED_ORANGE : LED_GREEN);
} else {
LED_ACTIVE_SET(LED_OFF);
+ }
}
}
=20
|
|
From: Anders J. <and...@us...> - 2003-11-12 10:26:00
|
The following file was modified in apps/bluetooth/utils/btinq:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
btinq.c 1.1 1.2=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Added pincodetype to btconfig.
Added usage info to btinq.
The diff of the modified file(s):
--- btinq.c 2003/11/04 10:59:39 1.1
+++ btinq.c 2003/11/12 10:25:35 1.2
@@ -63,13 +63,26 @@
* Syntax: btinq -n <max # returned> -t <max inq time> [-r]
*/
=20
+void
+usage()
+{
+ printf("Usage: btinq [OPTIONS]");
+ printf("Options:\n");
+ printf(" -r Enables remote device name lookup\n");
+ printf(" -h Prints this text\n");
+ printf(" -t <NUM> Set timeout to NUM seconds, default 10\n");
+ printf(" -n <NUM> Receive max NUM number of replies, default 10\n");
+}
+
+
int
main(int argc, char **argv)
{=20
- int bt_cfd, opt, t =3D 10, nbr =3D 10;
+ int bt_cfd, opt, t =3D 10, nbr =3D 10, i;
int get_name =3D 0;
+ inquiry_results *result =3D NULL;
=20
- while ((opt =3D getopt(argc, argv, "n:t:r")) !=3D -1)
+ while ((opt =3D getopt(argc, argv, "n:t:rh")) !=3D -1)
{
switch(opt)
{
@@ -85,6 +98,10 @@ main(int argc, char **argv)
/* Get the name of remote found devices */
get_name =3D 1;
break;
+ case 'h':
+ usage();
+ exit(0);
+ break;
=20=09=09=20
default:
break;
@@ -105,8 +122,42 @@ main(int argc, char **argv)
exit(1);
}
=20
- bt_inquiry(bt_cfd, nbr, t, get_name);
+ if(!(result =3D bt_inquiry(bt_cfd, nbr, t)))
+ {
+ fprintf(stderr, "Inquiry failed\n");
+ close(bt_cfd);
+ exit(1);
+ }
=20=20
+ for(i =3D 0 ; i < result->nbr_of_units ; i++)
+ {
+ printf("BD %d: %02x:%02x:%02x:%02x:%02x:%02x ",i,
+ result->bd_addr[0+6*i], result->bd_addr[1+6*i],
+ result->bd_addr[2+6*i], result->bd_addr[3+6*i],
+ result->bd_addr[4+6*i], result->bd_addr[5+6*i]);
+=20=20=20=20
+
+ if (get_name)
+ {
+ unsigned char name_device[255];
+ /* First print the number of units found */
+ /* Copy BD_ADDR to send in ioctl */
+
+ memcpy(name_device,result->bd_addr + 6*i, 6);
+
+ if((read_remote_name(bt_cfd, name_device, 255)) < 0)
+ {
+ printf("[unknown]");
+ }
+ else
+ {
+ printf("%s", name_device);
+ }
+ }
+=20=20=20=20
+ printf("\n");
+ }=20=20=20=20
+ free(result);
close(bt_cfd);
exit(0);
}
|
|
From: Anders J. <and...@us...> - 2003-11-12 10:26:00
|
The following file was modified in apps/bluetooth/utils/btconfig:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
btconfig.c 1.1 1.2=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Added pincodetype to btconfig.
Added usage info to btinq.
The diff of the modified file(s):
--- btconfig.c 2003/11/04 10:59:38 1.1
+++ btconfig.c 2003/11/12 10:25:35 1.2
@@ -107,6 +107,8 @@ static int var_force_ms_switch =3D -1; /*=20
static int var_dont_allow_slave =3D -1; /* not yet set */
static int var_set_local_name =3D 0;
static int var_max_connections =3D -1; /* not yet set */
+static int var_pincode_type =3D -1;
+
static short var_max_power =3D SHRT_MAX; /* not yet set */
=20
/* long option list */
@@ -120,6 +122,7 @@ static struct option long_options[] =3D
{ "max-connections", 1, NULL, 'c' }, /* sets max simultatious connectio=
ns */
{ "piconet-mode", 1, NULL, 'p' }, /* set if we disallow clients whic=
h doesn't support
the M/S switch */
+ { "pincode-type", 1, NULL, 't' }, /* sets pincode type */
{ 0, 0, 0, 0 }
};
=20
@@ -128,7 +131,26 @@ static struct option long_options[] =3D
void
show_usage(void)
{
- printf("Syntax: btconfig [--force-msswitch (0|1)] [--wrscan-enable <mode=
>] [--name <name>] [--file <config file>] [--max-connections (0-7)]\n");
+ printf("Usage: btconfig [OPTIONS]\n");
+ printf("Options:\n");
+ printf(" -f, --file=3DNAME Use configuration file NAME\n");
+ printf(" -h, --help Show usage\n");
+ printf(" -m, --force-msswitch=3DNUM Force m/s switch when acting as a s=
erver\n");
+ printf(" Values are 0 for false and 1 for true=
\n");
+ printf(" -w, --wrscan-enable=3DMODE Set the write scan enable parameter=
in the module\n");
+ printf(" Modes:\n");
+ printf(" 0: No scans enabled\n");
+ printf(" 1: Inquiry scan enabled, page scan d=
isabled\n");
+ printf(" 2: Inquiry scan disabled, page scan =
enabled\n");
+ printf(" 3: Inquiry scan enabled, page scan e=
nabled\n");
+ printf(" -n, --name=3DNAME Set the BT name to NAME\n");
+ printf(" -c, --max-connections=3DNUM Set max number of connections to NU=
M\n");
+ printf(" -p, --piconet-mode=3DNUM Set if we disallow clients which do=
esn't support\n");
+ printf(" the m/s switch. Values are 0 for fals=
e and 1 for true\n");
+ printf(" -t, --pincode-type=3DTYPE Set the pincode type in the module\=
n");
+ printf(" Types:\n");
+ printf(" 0: Variable pin\n");
+ printf(" 1: Fixed pin\n");
}
=20
int
@@ -139,13 +161,15 @@ main(int argc, char **argv)
int opt_force_ms_switch =3D -1;
int opt_max_connections =3D -1;
int opt_dont_allow_slave =3D -1;
+ int opt_pincode_type =3D -1;
+=20=20
=20=20=20
char *opt_name =3D NULL;
char *opt_config_file =3D CONF_FILE;
=20
/* Parse command line options */
=20
- while ((opt =3D getopt_long(argc, argv, "f:hm:n:w:c:p:",
+ while ((opt =3D getopt_long(argc, argv, "f:hm:n:w:c:p:t:",
long_options, &option_index)) !=3D -1)
{
switch (opt)
@@ -184,6 +208,10 @@ main(int argc, char **argv)
opt_dont_allow_slave =3D atoi(optarg);
break;
=20=20=20=20=20=20=20
+ case 't':
+ opt_pincode_type =3D atoi(optarg);
+ break;
+=20=20=20=20=20=20
default:
break;
}
@@ -209,6 +237,9 @@ main(int argc, char **argv)
if (opt_max_connections >=3D 0)
var_max_connections =3D opt_max_connections;
=20=20=20
+ if (opt_pincode_type >=3D 0)
+ var_pincode_type =3D opt_pincode_type;
+=20=20
/* Configure the stack according to the options specified */
=20
if (var_set_local_name ||
@@ -216,7 +247,8 @@ main(int argc, char **argv)
var_force_ms_switch >=3D 0 ||
var_max_connections >=3D 0 ||
var_max_power !=3D SHRT_MAX ||
- var_dont_allow_slave >=3D 0)
+ var_dont_allow_slave >=3D 0 ||
+ var_pincode_type >=3D 0)
{
/* Open BT ctrl device */=20=20
if ((bt_cfd =3D bt_openctrl()) < 0)
@@ -250,6 +282,9 @@ main(int argc, char **argv)
=20
if (var_dont_allow_slave >=3D 0)
bt_dont_allow_slave(bt_cfd, var_dont_allow_slave);
+
+ if (var_pincode_type >=3D 0)
+ bt_write_pin_type(bt_cfd, var_pincode_type);
=20=20=20=20=20
close(bt_cfd);
}
|
|
From: Anders J. <and...@us...> - 2003-11-12 10:18:37
|
The following file was modified in apps/bluetooth/utils/btpintype: Name Old version New version Tag Comment ---- ----------- ----------- --- ------- Makefile 1.1 1.2=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Corrected target. The diff of the modified file(s): --- Makefile 2003/11/06 19:11:17 1.1 +++ Makefile 2003/11/12 10:18:21 1.2 @@ -16,7 +16,7 @@ LDFLAGS +=3D -lopenbt =20 all: $(PROGS) =20 -btdisc: $(OBJS) +btpintype: $(OBJS) $(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@ =20 install: $(PROGS) |
|
From: Anders J. <and...@us...> - 2003-11-12 10:16:06
|
The following file was modified in linux/include/linux/bluetooth: Name Old version New version Tag Comment ---- ----------- ----------- --- ------- hci.h 1.83 1.84=20=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Added block-option to write_stored_link_key. The diff of the modified file(s): --- hci.h 2003/11/06 19:13:26 1.83 +++ hci.h 2003/11/12 10:15:44 1.84 @@ -164,7 +164,7 @@ void hci_flush_all(void); s32 hci_flush(u32 hdl); s32 hci_create_new_unit_link_key(void); s32 hci_read_stored_link_key(u8 *bd, u8 flag); -s32 hci_write_stored_link_key(u8 *bd, u8* link_key); +s32 hci_write_stored_link_key(u8 *bd, u8* link_key, s32 block); s32 hci_delete_stored_link_key(u8 *bd, u8 flag); s32 hci_change_local_name(u8 *new_name); s32 hci_read_scan_enable(void); |
|
From: Anders J. <and...@us...> - 2003-11-12 10:15:28
|
The following files were modified in linux/drivers/char/bluetooth:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
bluetooth.c 1.243 1.244=20=20=20=20=20=20=20=20=20=20=20=20=20
hci.c 1.212 1.213=20=20=20=20=20=20=20=20=20=20=20=20=20
sec_client.c 1.28 1.29=20=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Added block-option to write_link_key.=20
The diff of the modified file(s):
--- bluetooth.c 2003/11/06 19:12:52 1.243
+++ bluetooth.c 2003/11/12 10:15:05 1.244
@@ -1099,7 +1099,7 @@ hci_inq_exit0:
BT_DRIVER(__FUNCTION__ ": HCIWRITESTOREDLINKKEY\n");
copy_from_user(param, (s32*)arg, size);
=20
- result =3D hci_write_stored_link_key(param, param + 6);
+ result =3D hci_write_stored_link_key(param, param + 6, 1);
put_user(result, (s32*)arg);
break;
}
--- hci.c 2003/11/06 19:12:52 1.212
+++ hci.c 2003/11/12 10:15:05 1.213
@@ -1198,7 +1198,7 @@ process_event(u8 *buf, u32 len, u32 even
break;
=20
case LINK_KEY_NOTIFICATION:
- D_CMD(__FUNCTION__ ": LINK_KEY_NOTIFICATION forwarding event to security=
manager\n");
+ D_CMD(__FUNCTION__ ": LINK_KEY_NOTIFICATION (Keytype %02x) forwarding ev=
ent to security manager\n", buf[22]);
#ifdef CONFIG_BLUETOOTH_USE_SECURITY_MANAGER
sec_man_event(HCI, buf, LINK_KEY_NOTIFICATION, buf + 6, 16);
#endif
@@ -2695,7 +2695,7 @@ hci_read_stored_link_key(u8 *bd, u8 flag
}
=20
s32
-hci_write_stored_link_key(u8 *bd, u8* link_key)
+hci_write_stored_link_key(u8 *bd, u8* link_key, s32 block)
{
s32 tmp;
D_CMD(__FUNCTION__ "\n");
@@ -2708,11 +2708,15 @@ hci_write_stored_link_key(u8 *bd, u8* li
memcpy(c_pkt.data + 7, link_key, 16);
c_pkt.len =3D 23;
=20
+ if(block) {
tmp =3D send_cmd_block((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LE=
N, DEFAULT_TIMEOUT);
if (tmp < 0) {
return tmp;
} else {
return result_param;
+ }
+ } else {
+ return send_cmd((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN);
}
}
=20
--- sec_client.c 2003/11/05 15:21:59 1.28
+++ sec_client.c 2003/11/12 10:15:05 1.29
@@ -609,6 +609,10 @@ sec_man_event(enum security_requests use
case LINK_KEY_REQUEST:
hci_link_key_request_negative_reply(bd_addr, 0);
break;
+
+ case LINK_KEY_NOTIFICATION:
+ hci_write_stored_link_key(bd_addr, param, 0);
+ break;
default:
printk("Received event %d, no action\n", event);
}
|
|
From: Anders J. <and...@us...> - 2003-11-06 19:13:28
|
The following files were modified in linux/include/linux/bluetooth: Name Old version New version Tag Comment ---- ----------- ----------- --- ------- btcommon.h 1.102 1.103=20=20=20=20=20=20=20=20=20=20=20=20=20 hci.h 1.82 1.83=20=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Added IOCTL:s to write/read pincode type.=20 The diff of the modified file(s): --- btcommon.h 2003/11/05 19:03:45 1.102 +++ btcommon.h 2003/11/06 19:13:26 1.103 @@ -204,6 +204,8 @@ #define HCIWRITENUMBROADCASTRETRANSMISSIONS _IOWR(BT_IOC_MAGIC, 0x56, u8) #define HCIWRITEPAGETO _IOW(BT_IOC_MAGIC, 0x54, u32) #define HCIWRITELINKSUPERVISIONTO _IOW(BT_IOC_MAGIC, 0x58, u32[2]) +#define HCIWRITEPINTYPE _IOWR(BT_IOC_MAGIC, 0x60, s32) +#define HCIREADPINTYPE _IOWR(BT_IOC_MAGIC, 0x61, s32) =20 /* Informational Parameters */ #define HCIREADCOUNTRYCODE _IOR(BT_IOC_MAGIC, 0x43, s32) --- hci.h 2003/11/05 15:22:54 1.82 +++ hci.h 2003/11/06 19:13:26 1.83 @@ -187,6 +187,8 @@ s32 hci_read_clock_offset(u32 hdl); s32 hci_read_rssi(u32 hdl); s32 hci_read_num_broadcast_restransmissions(void); s32 hci_write_num_broadcast_restransmissions(u8 num_broadcast_retran); +s32 hci_read_pin_type(void); +s32 hci_write_pin_type(u8 type); =20 /* Informational Parameters */ s32 hci_read_local_bd(u8 *bd); |
|
From: Anders J. <and...@us...> - 2003-11-06 19:12:54
|
The following files were modified in linux/drivers/char/bluetooth:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
bluetooth.c 1.242 1.243=20=20=20=20=20=20=20=20=20=20=20=20=20
hci.c 1.211 1.212=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Added IOCTL:s to write/read pincode type.=20
The diff of the modified file(s):
--- bluetooth.c 2003/11/05 19:03:12 1.242
+++ bluetooth.c 2003/11/06 19:12:52 1.243
@@ -1634,6 +1634,33 @@ hci_inq_exit0:
return name_request_response[0];
}
=20
+ case HCIREADPINTYPE:
+ {
+ tmp =3D hci_read_pin_type();
+ if(tmp < 0)
+ {
+ tmp =3D -MSGCODE(MSG_LAYER_HCI, -tmp);
+ }
+=09=09
+ put_user(tmp, (s32*) arg);
+ break;
+ }
+
+ case HCIWRITEPINTYPE:
+ {
+ u8 type;
+ GET_USER(tmp, (s32*)arg);
+ type =3D (u8)(tmp & 0xff);
+ BT_DRIVER("BTWRITEPINTYPE: %d\n", type);
+ tmp =3D hci_write_pin_type(type);
+ if(tmp < 0)
+ {
+ tmp =3D -MSGCODE(MSG_LAYER_HCI, -tmp);
+ }
+ put_user(tmp, (s32*)arg);
+ break;
+ }=20=20=20
+
default:
return -ENOIOCTLCMD;
}
--- hci.c 2003/11/05 15:21:58 1.211
+++ hci.c 2003/11/06 19:12:52 1.212
@@ -1583,6 +1583,29 @@ process_return_param(u8 *buf)
D_CMD(__FUNCTION__ ": WRITE_NUM_BROADCAST_RETRANSMISSIONS \n ");
break;
=20
+ case READ_PIN_TYPE:
+ D_CMD(__FUNCTION__ ": READ_PIN_TYPE\n");
+ if (r_val[0]) {
+ D_ERR(__FUNCTION__ ": READ_PIN_TYPE: %s\n",=20
+ get_err_msg(r_val[0]));
+ result_param =3D -r_val[0];
+ } else {
+ result_param =3D r_val[1];
+ D_CMD(__FUNCTION__ ": READ_PIN_TYPE: %s\n", r_val[1] ? "Fixed" : "Vari=
able");
+ }
+ break;
+
+ case WRITE_PIN_TYPE:
+ D_CMD(__FUNCTION__ ": WRITE_PIN_TYPE\n");
+ if (r_val[0]) {
+ D_ERR(__FUNCTION__ ": WRITE_PIN_TYPE: %s\n",=20
+ get_err_msg(r_val[0]));
+ result_param =3D -r_val[0];
+ } else {
+ D_CMD(__FUNCTION__ ": WRITE_PIN_TYPE Success\n");
+ result_param =3D 0;
+ }
+ break;
=20
default:
D_CMD(__FUNCTION__ ": HCI_HC, ocf %d not recognised!\n", ocf);
@@ -3538,6 +3561,31 @@ s32 hci_read_rssi(u32 hdl)
tmp =3D send_cmd((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN);
=20
return (tmp<0)|(result_param=3D=3D256) ? 2<<8 : result_param|(1<<8);
+}
+
+s32 hci_read_pin_type(void)
+{
+ s32 tmp;
+ c_pkt.type =3D CMD_PKT;
+ c_pkt.opcode =3D hci_put_opcode(READ_PIN_TYPE, HCI_HC);
+ c_pkt.len =3D 0;
+ if((tmp =3D send_cmd_block((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HD=
R_LEN, DEFAULT_TIMEOUT)) < 0) {
+ return tmp;
+ }
+ return result_param;
+}
+
+s32 hci_write_pin_type(u8 type)
+{
+ s32 tmp;
+ c_pkt.type =3D CMD_PKT;
+ c_pkt.opcode =3D hci_put_opcode(WRITE_PIN_TYPE, HCI_HC);
+ c_pkt.data[0] =3D type;
+ c_pkt.len =3D 1;=09
+ if((tmp =3D send_cmd_block((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HD=
R_LEN, DEFAULT_TIMEOUT)) < 0) {
+ return tmp;
+ }
+ return result_param;
}
=20
/* Sends a connect request to the BT unit with the address bd_addr */
|
|
From: Anders J. <and...@us...> - 2003-11-06 19:12:10
|
The following files were modified in libs/openbt:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
bt_if.c 1.4 1.5=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
bt_if.h 1.4 1.5=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Added IOCTL:s to write/read pincode type.
The diff of the modified file(s):
--- bt_if.c 2003/11/05 19:04:53 1.4
+++ bt_if.c 2003/11/06 19:12:09 1.5
@@ -1164,6 +1164,40 @@ int bt_read_country_code(int bt_cfd)
return result;
}
=20
+int bt_read_pin_type(int bt_cfd)
+{
+ int retval;
+ if (ioctl(bt_cfd, HCIREADPINTYPE, &retval) < 0)
+ {
+ perror(__FUNCTION__);
+ exit(1);
+ }
+
+ if(retval < 0)
+ {
+ fprintf(stderr, "Read pin type failed [%s (%d)]\n", error_msg(retval),=
MSG_GET_CODE(-retval));
+ } else {
+ printf("Pin type: %s\n", retval =3D=3D 0 ? "Variable" : "Fixed");
+ }
+ return retval;
+}
+
+int bt_write_pin_type(int bt_cfd, int type)
+{
+ if (ioctl(bt_cfd, HCIWRITEPINTYPE, &type) < 0)
+ {
+ perror(__FUNCTION__);
+ exit(1);
+ }
+ if(type < 0)
+ {
+ fprintf(stderr, "Write pin type failed [%s (%d)]\n", error_msg(type), =
MSG_GET_CODE(-type));
+ } else {
+ printf("Success!\n");
+ }
+ return type;
+}
+
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
/* Misc functions */
=20
--- bt_if.h 2003/11/05 19:04:53 1.4
+++ bt_if.h 2003/11/06 19:12:09 1.5
@@ -190,6 +190,8 @@
#define HCIWRITEPAGETO _IOW(BT_IOC_MAGIC, 0x54, unsigned char[4])
#define HCIREADTRANSMITPOWERLEVEL _IOWR(BT_IOC_MAGIC, 0x57, unsigned char[=
3])
#define HCIWRITELINKSUPERVISIONTO _IOW(BT_IOC_MAGIC, 0x58, unsigned char[8=
])
+#define HCIWRITEPINTYPE _IOWR(BT_IOC_MAGIC, 0x60, int)
+#define HCIREADPINTYPE _IOWR(BT_IOC_MAGIC, 0x61, int)
=20
/* Informational Parameters */
=20
@@ -400,6 +402,11 @@ void set_local_hostname(int bt_cfd, cons
=20
/* Sets friendly name to name */
void bt_set_local_name(int bt_cfd, const unsigned char *name);
+
+/* Write / Read pin type */
+int bt_write_pin_type(int bt_cfd, int type);
+int bt_read_pin_type(int bt_cfd);
+
=20
/*
* Misc functions
|
|
From: Anders J. <and...@us...> - 2003-11-06 19:11:18
|
The following files were modified in apps/bluetooth/utils/btpintype: Name Old version New version Tag Comment ---- ----------- ----------- --- ------- Makefile 1.1 Added btpintype.c 1.1 Added The accompanying log: Used to read/write pincode type. |
|
From: Anders J. <and...@us...> - 2003-11-06 19:10:16
|
The following file was modified in apps/bluetooth/utils/btconnect:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
btcon.c 1.3 1.4=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Typo
The diff of the modified file(s):
--- btcon.c 2003/11/05 19:05:42 1.3
+++ btcon.c 2003/11/06 19:10:13 1.4
@@ -127,7 +127,7 @@ connect_bnep(unsigned char *bd,
int dest,
int src)
{
- printf("Connecting with BNEP using source UUID 0x%04x and dest UUIS 0x%0=
4x\n",
+ printf("Connecting with BNEP using source UUID 0x%04x and dest UUID 0x%0=
4x\n",
src, dest);
return bnep_connect(bt_cfd, bd,=20
src, dest,
|
|
From: Anders J. <and...@us...> - 2003-11-05 21:30:14
|
The following files were modified in libs/openbt:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
bt_if.c 1.3 1.4=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
bt_if.h 1.3 1.4=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
bt_misc.c 1.1 1.2=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
bt_misc.h 1.1 1.2=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* Added bt_disconnect_all.
* Added strtobd to parse bd-address-strings.
* Removed all USERSTACK defines.
The diff of the modified file(s):
--- bt_if.c 2003/11/05 15:24:05 1.3
+++ bt_if.c 2003/11/05 19:04:53 1.4
@@ -74,14 +74,11 @@ int init_stack(int bt_cfd, char * local_
{
syslog(LOG_INFO, "Init stack");
=20
-#ifndef BT_USERSTACK
if (ioctl(bt_cfd, BTINITSTACK) < 0)
{
return -1;
}
-#else
- init_userstack();
-#endif
+
=20
if (!bt_dfu_mode(bt_cfd, -1))
{
@@ -125,25 +122,12 @@ int bt_isinitiated(int bt_cfd)
void shutdown_stack(int bt_cfd)
{
syslog(LOG_INFO, "Shutting down bluetooth stack");
-#ifndef BT_USERSTACK
if (bt_cfd !=3D -1 && (ioctl(bt_cfd, BTSHUTDOWN) < 0))
{
syslog(LOG_ERR, "Shutting down stack failed (bt_cfd =3D %d)", bt_cfd);
}
-#else
- if (bt_initdone)
- {
- rfcomm_close();
- sdp_shutdown();
- tcs_shutdown();
- l2cap_shutdown();
- btmem_shutdown();
- bt_initdone =3D 0;
- }
-#endif
}
=20
-#ifndef BT_USERSTACK
char* bt_hw_vendor(void)
{
int bt_cfd =3D bt_openctrl();
@@ -157,11 +141,9 @@ char* bt_hw_vendor(void)
close(bt_cfd);
return buffer;
}
-#endif
=20
char* bt_firmware_info(void)
{
-#ifndef BT_USERSTACK
int bt_cfd =3D bt_openctrl();
static char buffer[80];
=20
@@ -172,15 +154,11 @@ char* bt_firmware_info(void)
}
close(bt_cfd);
return buffer;
-#else
- return bt_hw_firmware();
-#endif
}
=20
int
bt_bcsp_mode(int bt_cfd, int enable)
{
-#ifndef BT_USERSTACK
int fd =3D (bt_cfd < 0 ? bt_openctrl() : bt_cfd);
=20
if (fd < 0 || ioctl(fd, BTSETBCSPMODE, &enable) < 0)
@@ -195,15 +173,11 @@ bt_bcsp_mode(int bt_cfd, int enable)
}
=20
return enable;
-#else
- return 0;
-#endif
}
=20
int
bt_dfu_mode(int bt_cfd, int enable)
{
-#ifndef BT_USERSTACK
if (ioctl(bt_cfd, BT_SET_DFU_MODE, &enable) < 0)
{
perror(__FUNCTION__);
@@ -211,9 +185,6 @@ bt_dfu_mode(int bt_cfd, int enable)
}
=20
return enable;
-#else
- return 0;
-#endif
}
=20
void reset_hw(void)
@@ -247,16 +218,11 @@ int bt_openctrl(void)
int bt_cfd;
=20
D(syslog(LOG_INFO, "Now opening BT Ctrl TTY [" BT_CTRL_TTY "]"));
-#ifdef BT_USERSTACK
- printf(__FUNCTION__ ": ignored in userstack\n");
- return FD_BTUSERCTRL;
-#else
if ((bt_cfd =3D open(BT_CTRL_TTY, O_RDWR | O_NOCTTY)) < 0)
{
fprintf(stderr, "Could not open " BT_CTRL_TTY "\n");
exit(1);
}
-#endif
return bt_cfd;
}
=20
@@ -303,20 +269,10 @@ bt_disconnect(int bt_fd, unsigned int co
{
int ret_val =3D 0;
=20
-#ifndef BT_USERSTACK
if ((ret_val =3D ioctl(bt_fd, BTDISCONNECT, &con_id)))
printf("Disconnect failed [%s (%d)]\n", error_msg(ret_val), MSG_GET_CO=
DE(-ret_val));
else
printf("Disconnected.\n");
-#else
- if ((GET_PSM(con_id) =3D=3D RFCOMM_LAYER) && ((con_id >> 8) & 0xff) !=3D=
0)
- {
- printf("Use line 0 instead ! (usermode only)\n");
- return -1;
- }
-
- ret_val =3D bt_disconnect(con_id);
-#endif
return ret_val;
}
=20
@@ -334,32 +290,37 @@ bt_disconnect_bb(int bt_fd, unsigned cha
{
buf[5-i] =3D (unsigned char)*rem_bd++;
}
-#ifndef BT_USERSTACK
+
if ((ret_val =3D ioctl(bt_fd, BTDISCONNECT_BB, buf)) < 0)
printf("Disconnect BB failed [%s (%d)] err=3D%s\n", error_msg(ret_val)=
, MSG_GET_CODE(-ret_val), strerror(errno));
else
printf("BB Disconnected\n");
-#else
- fprintf(stderr, __FUNCTION__ ": Not yet implemented...\n");
-#endif
return ret_val;
}
=20
+/* Disconnect all connections */
+int
+bt_disconnect_all(int bt_cfd)
+{=20
+ if (bt_cfd !=3D -1 && (ioctl(bt_cfd, BTDISCONNECT_ALL) < 0))
+ {
+ fprintf(stderr, "Disconnect All failed: %s", strerror(errno));
+ return -1;
+ }
+ return 0;
+}
+
/* Check whether this line is lower connected in stack (rfcomm ready) */
int bt_isconnected(int bt_cfd, int line)
{
int fd =3D (bt_cfd < 0 ? bt_openctrl() : bt_cfd);
int ret;
-#ifndef BT_USERSTACK
if (fd < 0 || (ret =3D ioctl(fd, BTISLOWERCONNECTED, &line)) < 0)
{
perror(__FUNCTION__);
exit(1);
}
-#else
- fprintf(stderr, __FUNCTION__ ": Not yet implemented...\n");
- ret =3D -1;
-#endif
+
if (bt_cfd < 0)
{
close(fd);
@@ -369,16 +330,7 @@ int bt_isconnected(int bt_cfd, int line)
=20
void bt_showstatus(void)
{
-#ifdef BT_USERSTACK
- char tmp[4096];
- int len;
-
- len =3D bt_read_internal(tmp);
- tmp[len] =3D 0;
- printf(tmp);
-#else
system("cat /proc/bt_internal");
-#endif
}
=20
int
@@ -446,51 +398,36 @@ void
bt_waitline(int bt_fd, int line)
{
printf("Wait for a connection on line %d\n", line);
-#ifndef BT_USERSTACK
if (ioctl(bt_fd, BTWAITFORCONNECTION, &line) < 0)
{
perror(__FUNCTION__);
exit(1);
}
printf("%s: Got a connection !\n", __FUNCTION__);
-#else
- /* fixme<1> */
- fprintf(stderr, __FUNCTION__ ": Not yet implemented...\n");
-#endif
}
=20
void
bt_waitnewconnections(int bt_fd)
{
printf("Wait for a new connection\n");
-#ifndef BT_USERSTACK
if (ioctl(bt_fd, BTWAITNEWCONNECTIONS) < 0)
{
perror(__FUNCTION__);
exit(1);
}
printf("%s: Found a connection !\n", __FUNCTION__);
-#else
- /* fixme<1>*/
- fprintf(stderr, __FUNCTION__ ": Not yet implemented...\n");
-#endif
}
=20
void
bt_waitconnection(int bt_fd, int line)
{
printf("Wait for a connection on line %d\n", line);
-#ifndef BT_USERSTACK
if (ioctl(bt_fd, BTWAITFORCONNECTION, &line) < 0)
{
perror(__FUNCTION__);
exit(1);
}
printf("%s: Got a connection !\n", __FUNCTION__);
-#else
- /* fixme<1>*/
- fprintf(stderr, __FUNCTION__ ": Not yet implemented...\n");
-#endif
}
=20
int bt_send_raw_hci(int bt_cfd, unsigned char *data, char len)
@@ -503,16 +440,11 @@ int bt_send_raw_hci(int bt_cfd, unsigned
=20
print_data("data :", (char*)buf, (int)len+1);
=20
-#ifndef BT_USERSTACK
if (ioctl(bt_cfd, HCISENDRAWDATA, buf) < 0)
{
perror(__FUNCTION__);
return -1;
}
-#else
- fprintf(stderr, __FUNCTION__ ": Not yet implemented...\n");
- //hci_send_raw_data(data, 16);
-#endif
return 0;
}
=20
@@ -531,7 +463,6 @@ bt_send_dfu_command(int bt_cfd, int len,
=20
memcpy((int *)buf+1, data, len);
=20
-#ifndef BT_USERSTACK
if (ioctl(bt_cfd, BT_SEND_DFU_COMMAND, buf) < 0)
{
perror(__FUNCTION__);
@@ -539,11 +470,6 @@ bt_send_dfu_command(int bt_cfd, int len,
}
=20
return 0;
-#else
- fprintf(stderr, __FUNCTION__ ": Not yet implemented...\n");
- errno =3D EPERM;
- return -1;
-#endif
}
=20
int
@@ -551,7 +477,6 @@ bt_retrieve_dfu_response(int bt_cfd, int
{
*(int *)data =3D len - sizeof(int);
=20
-#ifndef BT_USERSTACK
if (ioctl(bt_cfd, BT_RETRIEVE_DFU_RESPONSE, data) < 0)
{
perror(__FUNCTION__);
@@ -562,11 +487,6 @@ bt_retrieve_dfu_response(int bt_cfd, int
=20
memmove(data, (int *)data+1, len);
return len;
-#else
- fprintf(stderr, __FUNCTION__ ": Not yet implemented...\n");
- errno =3D EPERM;
- return -1;
-#endif
}
=20
int bt_ping(int bt_cfd, unsigned char bd[6],
@@ -580,16 +500,12 @@ int bt_ping(int bt_cfd, unsigned char bd
ping.len =3D len;
memcpy(ping.data, data, len);
=20
-#ifndef BT_USERSTACK
if ((ret_val =3D ioctl(bt_cfd, BTPING, &ping)) < 0)
{
printf("Error : [%s (%d)]\n", error_msg(ret_val), MSG_GET_CODE(-ret_va=
l));
}
else
printf("Success!\n");
-#else
- ret_val =3D l2ca_ping(bd, data, len);
-#endif
return ret_val;
}
=20
@@ -603,16 +519,12 @@ bt_getinfo(int bt_cfd, unsigned char bd[
msg[6] =3D (unsigned char)(type >> 8);
msg[7] =3D (unsigned char)(type & 0xff);
=20
-#ifndef BT_USERSTACK
if ((ret_val =3D ioctl(bt_cfd, BTGETINFO, msg)) < 0)
{
printf("Error : [%s (%d)]\n", error_msg(ret_val), MSG_GET_CODE(-ret_va=
l));
}
else
printf("Success!\n");
-#else
- ret_val =3D l2ca_getinfo(bd, type);
-#endif
return ret_val;
}
=20
@@ -627,44 +539,34 @@ int bt_testcmd(int bt_cfd, unsigned char
tmp[0] =3D len;
memcpy(tmp+1, cmd, len+1); /* don't forget nullterminate... */
=20
-#ifndef BT_USERSTACK
if ((ret_val =3D ioctl(bt_cfd, BTTESTCOMMAND, tmp)) < 0)
{
printf("Error : [%s (%d)]\n", error_msg(ret_val), MSG_GET_CODE(-ret_va=
l));
}
else
printf("Success!\n");
-#else
- ret_val =3D test_process_cmd(&tmp[1], tmp[0]);
-#endif
return ret_val;
}
=20
int bt_force_msswitch_as_server(int bt_cfd, int enable)
{
syslog(LOG_INFO, "%s: %d", __FUNCTION__, enable);
-#ifndef BT_USERSTACK
if (ioctl(bt_cfd, BTSETMSSWITCH, &enable) < 0)
{
perror(__FUNCTION__);
return -1;
}
-#else
- hci_force_msswitch(enable);
-#endif
return 0;
}
=20
int bt_dont_allow_slave(int bt_cfd, int flag)
{
syslog(LOG_INFO, "%s: %d", __FUNCTION__, flag);
-#ifndef BT_USERSTACK
if (ioctl(bt_cfd, BTDONTALLOWSLAVE, &flag) < 0)
{
perror(__FUNCTION__);
return -1;
}
-#endif
return 0;
}
=20
@@ -672,7 +574,6 @@ int bt_dont_allow_slave(int bt_cfd, int=20
int bt_set_max_conections(int bt_cfd, int connections)
{
syslog(LOG_INFO, "%s: %d", __FUNCTION__, connections);
-#ifndef BT_USERSTACK
if (ioctl(bt_cfd, BTSETMAXCONNECTIONS, &connections) < 0)
{
perror(__FUNCTION__);
@@ -680,19 +581,6 @@ int bt_set_max_conections(int bt_cfd, in
}
=20
return 0;
-#else
- {
- int ret_val =3D hci_set_max_connections(connections);
-
- if (ret_val >=3D 0)
- {
- return ret_val;
- }
-
- errno =3D -ret_val;
- return -1;
- }
-#endif
}
=20
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
@@ -712,7 +600,6 @@ bnep_connect(int bt_fd, unsigned char *b
con.bnep_src_uuid =3D srcservice;
con.bnep_dst_uuid =3D dstservice;
=20
-#ifndef BTD_USERSTACK
result =3D ioctl(bt_fd, BNEPCONNECT, &con);
if (result&0x0ff)
{
@@ -724,9 +611,6 @@ bnep_connect(int bt_fd, unsigned char *b
printf("BNEP connected on con_hdl =3D %.2X:%.2X\n", bd[0], bd[1]);
printf("BNEP Interface =3D 0x%X\n", bd[2]);
}
-#else
- printf(__FUNCTION__ ": Unsupported in usermode\n");
-#endif
return result;
}
=20
@@ -734,8 +618,6 @@ void
bnep_disconnect(int bt_fd, unsigned char *bd)
{
int result;
-
-#ifndef BTD_USERSTACK
result =3D ioctl(bt_fd, BNEPDISCONNECT, bd);
if (result)
{
@@ -746,9 +628,6 @@ bnep_disconnect(int bt_fd, unsigned char
{
printf("BNEP disconnect OK\n");
}
-#else
- printf(__FUNCTION__ ": Unsupported in usermode\n");
-#endif
}
=20
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
@@ -757,7 +636,6 @@ bnep_disconnect(int bt_fd, unsigned char
void
bt_read_rssi(int bt_cfd, unsigned char* con_hdl)
{
-#ifndef BTD_USERSTACK
if (ioctl(bt_cfd, HCIREADRSSI, con_hdl) < 0)
{
perror(__FUNCTION__);
@@ -773,93 +651,65 @@ bt_read_rssi(int bt_cfd, unsigned char*=20
printf("Not valid RSSI value !!!\n");
}
}
-#else
- fprintf(stderr, __FUNCTION__ ": Not yet implemented...\n");
-#endif
}
=20
void
bt_park_mode(int bt_cfd, unsigned char* park_params)
{
-#ifndef BTD_USERSTACK
if (ioctl(bt_cfd, HCIPARKMODE, park_params) < 0)
{
perror(__FUNCTION__);
}
-#else
- fprintf(stderr, __FUNCTION__ ": Not yet implemented...\n");
-#endif
}
=20
void
bt_exit_park_mode(int bt_cfd, unsigned char* con_hdl)
{
-#ifndef BTD_USERSTACK
if (ioctl(bt_cfd, HCIEXITPARKMODE, con_hdl) < 0)
{
perror(__FUNCTION__);
}
-#else
- fprintf(stderr, __FUNCTION__ ": Not yet implemented...\n");
-#endif
}
=20
void
bt_sniff_mode(int bt_cfd, unsigned char* sniff_params)
{
-#ifndef BTD_USERSTACK
if (ioctl(bt_cfd, HCISNIFFMODE, sniff_params) < 0)
{
perror(__FUNCTION__);
}
-#else
- fprintf(stderr, __FUNCTION__ ": Not yet implemented...\n");
-#endif
}
=20
void
bt_exit_sniff_mode(int bt_cfd, unsigned char* con_hdl)
{
-#ifndef BTD_USERSTACK
if (ioctl(bt_cfd, HCIEXITSNIFFMODE, con_hdl) < 0)
{
perror(__FUNCTION__);
}
-#else
- fprintf(stderr, __FUNCTION__ ": Not yet implemented...\n");
-#endif
}
=20
void
bt_hold_mode(int bt_cfd, unsigned char* hold_params)
{
-#ifndef BTD_USERSTACK
if (ioctl(bt_cfd, HCIHOLDMODE, hold_params) < 0)
{
perror(__FUNCTION__);
}
-#else
- fprintf(stderr, __FUNCTION__ ": Not yet implemented...\n");
-#endif
}
=20
void
bt_write_link_policy_settings(int bt_cfd, unsigned char* policy_params)
{
-#ifndef BTD_USERSTACK
if (ioctl(bt_cfd, HCIWRITELINKPOLICYSETTINGS, policy_params) < 0)
{
perror(__FUNCTION__);
}
-#else
- fprintf(stderr, __FUNCTION__ ": Not yet implemented...\n");
-#endif
}
=20
void
bt_read_clock_offset(int bt_cfd, unsigned char* con_hdl)
{
-#ifndef BTD_USERSTACK
if (ioctl(bt_cfd, HCIREADCLOCKOFFSET, con_hdl) < 0)
{
perror(__FUNCTION__);
@@ -875,9 +725,6 @@ bt_read_clock_offset(int bt_cfd, unsigne
printf("Not valid CLOCK OFFSET value !!!\n");
}
}
-#else
- fprintf(stderr, __FUNCTION__ ": Not yet implemented...\n");
-#endif
}
=20
void
@@ -885,7 +732,6 @@ bt_read_num_broadcast_rtx(int bt_cfd)
{
unsigned char num_rtx[2];
=20
-#ifndef BTD_USERSTACK
if (ioctl(bt_cfd, HCIREADNUMBROADCASTRETRANSMISSIONS, num_rtx) < 0)
{
perror(__FUNCTION__);
@@ -901,41 +747,29 @@ bt_read_num_broadcast_rtx(int bt_cfd)
printf("Not valid BROADCAST RTX value =3D 0x%X !!!\n",num_rtx[1]);
}
}
-#else
- fprintf(stderr, __FUNCTION__ ": Not yet implemented...\n");
-#endif
}
=20
void
bt_write_num_broadcast_rtx(int bt_cfd, unsigned char* num_rtx)
{
-#ifndef BTD_USERSTACK
if (ioctl(bt_cfd, HCIWRITENUMBROADCASTRETRANSMISSIONS, num_rtx) < 0)
{
perror(__FUNCTION__);
}
-#else
- fprintf(stderr, __FUNCTION__ ": Not yet implemented...\n");
-#endif
}
=20
void
bt_write_page_to(int bt_cfd, unsigned char* page_to)
{
-#ifndef BTD_USERSTACK
if (ioctl(bt_cfd, HCIWRITEPAGETO, page_to) < 0)
{
perror(__FUNCTION__);
}
-#else
- fprintf(stderr, __FUNCTION__ ": Not yet implemented...\n");
-#endif
}
=20
void
bt_read_tx_power_level(int bt_cfd, unsigned char* tx_power_level)
{
-#ifndef BTD_USERSTACK
if (ioctl(bt_cfd, HCIREADTRANSMITPOWERLEVEL, tx_power_level) < 0)
{
perror(__FUNCTION__);
@@ -951,28 +785,20 @@ bt_read_tx_power_level(int bt_cfd, unsig
printf("Not valid TX POWER LEVEL value !!!\n");
}
}
-#else
- fprintf(stderr, __FUNCTION__ ": Not yet implemented...\n");
-#endif
}
=20
void
bt_write_link_supervision_to(int bt_cfd, unsigned char* link_to)
{
-#ifndef BTD_USERSTACK
if (ioctl(bt_cfd, HCIWRITELINKSUPERVISIONTO, link_to) < 0)
{
perror(__FUNCTION__);
}
-#else
- fprintf(stderr, __FUNCTION__ ": Not yet implemented...\n");
-#endif
}
=20
void
bt_write_page_scan_activity(int bt_cfd, unsigned char* page_scan)
{
-#ifndef BTD_USERSTACK
printf("Setting write_pagescan_activity: p_s_int =3D 0x%X%X p_s_win =3D =
0x%X%X\n",
page_scan[0] & 0xFF, page_scan[1] & 0xFF,
page_scan[4] & 0xFF, page_scan[5] & 0xFF);
@@ -981,26 +807,12 @@ bt_write_page_scan_activity(int bt_cfd,=20
{
perror(__FUNCTION__);
}
-#else
- fprintf(stderr, __FUNCTION__ ": Not yet implemented...\n");
-#endif
}
=20
inquiry_results *
bt_inquiry(int bt_cfd, int nbr_rsp, int t)
{
int retval =3D 0;
-#ifdef BTD_USERSTACK
- char inq_lap[6];
-
- printf("Inquiring...\n");
-
- inq_lap[0] =3D 0x33;
- inq_lap[1] =3D 0x8b;
- inq_lap[2] =3D 0x9e;
-
- retval =3D hci_inquiry(inq_lap, t, nbr_rsp);
-#else
inquiry_results *inq_res;
=20
if (!(inq_res =3D malloc(sizeof *inq_res + nbr_rsp * 6)))
@@ -1020,8 +832,6 @@ bt_inquiry(int bt_cfd, int nbr_rsp, int=20
}
=20
return inq_res;
-#endif
- return inq_res;
}
=20
void
@@ -1030,15 +840,10 @@ bt_set_bd_addr(int bt_cfd, unsigned char
printf("Setting BD address to: %02X:%02X:%02X:%02X:%02X:%02X\n",
bd[0], bd[1], bd[2],
bd[3], bd[4], bd[5]);
-
-#ifndef BT_USERSTACK
if (ioctl(bt_cfd, HCIWRITEBDADDR, bd) < 0)
{
perror(__FUNCTION__);
}
-#else
- hci_set_bd_addr(bd);
-#endif
printf("Please reset HW to activate bd change\n");
}
=20
@@ -1051,40 +856,22 @@ int bt_set_baudrate(int bt_cfd, const ch
unsigned long spd =3D speedstrtoli(speedstr);
=20
syslog(LOG_INFO, "%s: %lu baud", __FUNCTION__, spd);
-#ifdef BT_USERSTACK
- tcflush(phys_fd, TCIOFLUSH);
- result =3D hci_set_baudrate(spd);
- usleep(10000);
-#else
+
if ((result =3D ioctl(bt_cfd, HCISETBAUDRATE, &spd)) < 0)
{
perror(__FUNCTION__);
exit(1);
}
-#endif
return result;
}
=20
void
read_local_bd(int bt_cfd, unsigned char *bd_addr)
{
-#ifndef BT_USERSTACK
if (ioctl(bt_cfd, HCIREADLOCALBDADDR, bd_addr) < 0)
{
perror(__FUNCTION__);
}
-#else
- int i;
- BD_ADDR rev_bd;
-
- hci_read_local_bd(rev_bd);
-
- /* return as big endian */
- for (i =3D 0; i < 6; i++)
- {
- bd_addr[i] =3D rev_bd[5-i];
- }
-#endif
}
=20
void=20
@@ -1099,23 +886,13 @@ read_remote_class(int bt_cfd, unsigned c
{
result[i] =3D bd_addr[5-i];
}
-#ifndef BT_USERSTACK
=20
if (ioctl(bt_cfd, BTREADREMOTECLASSOFDEV, result) < 0)
{
perror(__FUNCTION__);
err =3D -1;
}
-#else
- if((con =3D get_con(result, ANY_STATE)))=20
- {
- memcpy(result, con->remote_class_of_dev, 3);
- }=20
- else=20
- {
- err =3D -1;
- }
-#endif
+
if(err < 0)
{
memset(remote_class, 0, 3);
@@ -1132,39 +909,22 @@ void
enable_dut(int bt_cfd)
{
printf("Enable device under test mode\n");
-#ifndef BT_USERSTACK
if (ioctl(bt_cfd, HCIENABLEDUT) < 0)
{
perror(__FUNCTION__);
}
-#else
- hci_enable_dut();
-#endif
printf("done.\n");
}
=20
void
read_remote_bd(int bt_cfd, int line, unsigned char *bd_addr)
{
-#ifndef BT_USERSTACK
*(int*)bd_addr =3D line;
=20
if (ioctl(bt_cfd, BTREADREMOTEBDADDR, bd_addr) < 0)
{
perror(__FUNCTION__);
}
-#else
- BD_ADDR rev_bd;
- int i;
-
- get_remote_bd(bt_get_conhdl_from_line(line), rev_bd);
-
- /* return as big endian */
- for (i =3D 0; i < 6; i++)
- {
- bd_addr[i] =3D rev_bd[5-i];
- }
-#endif
}
=20
int
@@ -1177,8 +937,6 @@ read_remote_name(int bt_cfd, unsigned ch
{
cpylen =3D 254;
}
-=20=20
-#ifndef BT_USERSTACK
if (ioctl(bt_cfd, HCIREMOTENAME_REQUEST, tmpbuf) < 0)
{
perror(__FUNCTION__);
@@ -1188,10 +946,6 @@ read_remote_name(int bt_cfd, unsigned ch
memcpy(buf, tmpbuf, cpylen);
buf[cpylen] =3D 0;
return 0;
-#else
- fprintf(stderr, __FUNCTION__ ": Not yet implemented...\n");
- return -1;
-#endif
}
=20
int bt_write_scan_enable(int bt_cfd, unsigned int flags)
@@ -1200,16 +954,11 @@ int bt_write_scan_enable(int bt_cfd, uns
=20
syslog(LOG_INFO, "Setting write_scan_enable: 0x%x", flags);
=20
-#ifdef BT_USERSTACK
- result =3D hci_write_scan_enable(flags);
-#else
-
if ((result =3D ioctl(bt_cfd, HCIWRITESCANENABLE, &flags)) < 0)
{
perror(__FUNCTION__);
exit(1);
}
-#endif
return result;
}
=20
@@ -1218,17 +967,10 @@ bt_write_pagescan_activity(int bt_cfd, u
unsigned int wind)
{
/* improves reliability when doing a connect */
-
+ unsigned int tmp[2];
syslog(LOG_INFO, "Setting write_pagescan_activity: int:0x%x wind:0x%x",
interval, wind);
=20
-
-#ifdef BT_USERSTACK
- hci_write_pagescan_activity(interval, wind);
-#else
- {
- unsigned int tmp[2];
-
tmp[0] =3D interval;
tmp[1] =3D wind;
=20
@@ -1238,8 +980,6 @@ bt_write_pagescan_activity(int bt_cfd, u
exit(1);
}
}
-#endif
-}
=20
int bt_set_event_filter(int bt_cfd, unsigned char *filter, int len)
{
@@ -1248,10 +988,6 @@ int bt_set_event_filter(int bt_cfd, unsi
=20
syslog(LOG_INFO, "Setting event filter");
=20
-#ifdef BT_USERSTACK
- result =3D hci_set_event_filter((u8*)filter, len);
-#else
-
tmp[0] =3D (len >> 8) & 0xff;
tmp[1] =3D len & 0xff;
memcpy(&tmp[2], filter, len);
@@ -1261,7 +997,6 @@ int bt_set_event_filter(int bt_cfd, unsi
perror(__FUNCTION__);
exit(1);
}
-#endif
return result;
}
=20
@@ -1282,15 +1017,11 @@ bt_set_classofdevice(int bt_cfd, unsigne
class_of_device[1] =3D ((service_class & 0x7) << 5) | (major_class & 0=
x1f);
class_of_device[2] =3D (service_class & 0x7f8) >> 3;
=20
-#ifndef BT_USERSTACK
if (ioctl(bt_cfd, HCIWRITECLASSOFDEVICE, class_of_device) < 0)
{
perror(__FUNCTION__);
exit(1);
}
-#else
- hci_write_class_of_device(class_of_device);
-#endif
break;
=20
case 1:
@@ -1324,20 +1055,15 @@ role_switch(int bt_cfd, unsigned char* b
=20
tmp[6] =3D (unsigned char)role;
=20
-#ifndef BT_USERSTACK
if (ioctl(bt_cfd, HCISWITCHROLE, tmp) < 0)
{
perror(__FUNCTION__);
}
-#else
- hci_switch_role(bd_addr, role);
-#endif
}
=20
void
set_bt_line_disc(int phys_fd, int bt_disc, char* physdev)
{
-#ifndef BT_USERSTACK
if (ioctl(phys_fd, TIOCSETD, &bt_disc) < 0)
{
perror(__FUNCTION__);
@@ -1345,9 +1071,6 @@ set_bt_line_disc(int phys_fd, int bt_dis
exit(1);
}
syslog(LOG_INFO, "Registered bluetooth line discipline on %s", physdev);
-#else
- fprintf(stderr, __FUNCTION__ ": Ignored in usermode stack\n");
-#endif
}
=20
=20
@@ -1423,32 +1146,22 @@ void bt_set_local_name(int bt_cfd, const
}
}
buffer[i] =3D '\0';
-
-#ifndef BT_USERSTACK
if (ioctl(bt_cfd, HCISETLOCALNAME, buffer) < 0)
{
perror(__FUNCTION__);
exit(1);
}
-#else
- hci_change_local_name(buffer);
-#endif
}
=20
int bt_read_country_code(int bt_cfd)
{
int result;
-
-#ifndef BT_USERSTACK
if (ioctl(bt_cfd, HCIREADCOUNTRYCODE, &result) < 0)
{
perror(__FUNCTION__);
exit(1);
}
return result;
-#else
- return hci_read_country_code();
-#endif
}
=20
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
@@ -1580,18 +1293,6 @@ int open_device(char* dev, int flags, in
{
int fd;
=20
-#ifdef BT_USERSTACK
- /* if opening bt dev or control dev simply discard and return fake fd */
- if ((strncmp(dev, "/dev/ttyBT", 11) =3D=3D 0) || (strcmp(dev, BT_CTRL_TT=
Y) =3D=3D 0))
- return 0xb055e;
-#if 0 /* fixme */
- if (use_local_socket)
- return open_socket(dev, role);
- else if (use_tcp_socket)
- return open_tcpsocket(dev, role);
-#endif
-#endif
-
D(syslog(LOG_INFO, "Opening dev %s", dev));
if ((fd =3D open(dev, flags | O_NOCTTY)) < 0)
{
@@ -1606,15 +1307,8 @@ int open_device(char* dev, int flags, in
void close_device(int fd)
{
D(syslog(LOG_INFO, __FUNCTION__));
-
-#ifdef BT_USERSTACK
- /* if fake fd is used, ignore close since there are no open fd */
- if (fd !=3D 0xb055e)
- close(fd);
-#else
if (fd !=3D -1)
close(fd);
-#endif
}
=20
int start_sdp_server(void)
@@ -1636,280 +1330,37 @@ int start_sdp_server(void)
return sdpsrv_pid;
}
=20
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
-/* Functions used in usermode stack only */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
-
-/*
- *
- * FIXME -- NOT CHECKED AT ALL AFTER SPLIT UP OF BTD !!!!
- *
- */
-
-#ifdef BT_USERSTACK
-
-
-#if BT_DATADUMP_DEBUG
-#define BT_DATADUMP(str, data, len) print_data(str, data, len)
-#else
-#define BT_DATADUMP(str, data, len)
-#endif
-
-#if BT_DATA_DEBUG
-#if BT_USE_TIMESTAMPS
-#define BT_DATA(fmt...) do { print_time(1); printk(BT_DBG_STR"DATA " fmt);=
} while (0)
-#else
-#define BT_DATA(fmt...) printk(BT_DBG_STR"DATA " fmt)
-#endif /* BT_USE_TIMESTAMPS */
-
-#else /* BT_DATA_DEBUG */
-#define BT_DATA(fmt...)
-#endif /* BT_DATA_DEBUG */
-
-
-int init_read_thread(void)
-{
- printf("Initiating read thread\n");
- if (pthread_create(&read_thread, NULL, (void*)hci_receive_thread, NULL) =
!=3D 0)
- perror(__FUNCTION__);
- sleep(1); /* wait for thread to start */
- return 0;
-}
-
-void hci_receive_thread(void)
-{
- fd_set rfd;
- char databuf[4096];
-
- while (1)
- {
- FD_ZERO(&rfd);
- FD_SET(phys_fd, &rfd);
-
- select(phys_fd+1, &rfd, NULL, NULL, NULL);
-
- if (FD_ISSET(phys_fd, &rfd))
- {
- int len =3D read(phys_fd, &databuf, 4096);
-
- if (len > 0)
- {
- BT_DATA("-->|X| %3d\n", len);
- BT_DATADUMP("-->|X|", databuf, len);
- hci_receive_data(databuf, len);
- }
- }
- }
-}
-
-void
-init_upper_pty(void)
-{
- printf(__FUNCTION__);
-// open_pty();
-// init_pty_thread();
-}
-
-
-void init_userstack()
+int strtobd(unsigned char *src, unsigned char *dst)
{
- /* Direct function calls instead of ioctls... */
-
- init_read_thread();
-
- /* Initialise all layers in the bluetooth stack */
- DSYS("Initialising Bluetooth Stack\n");
-
- hci_init();
- l2cap_init();
- rfcomm_init();
- sdp_init(SERVER);
- tcs_init();
- test_init();
- btmem_init();
- unplug_test_init();
-
- bt_stat.bytes_received =3D 0;
- bt_stat.bytes_sent =3D 0;
-
- bt_initdone =3D 1;
-}
-
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
-/* Stack interface functions */
+ int bd[6], parseok =3D 0, i;
=20
-int bt_write_lower_driver(unsigned char *data, int len)
+ if (sscanf(src, "%2x%2x%2x%2x%2x%2x",
+ &bd[0], &bd[1], &bd[2],
+ &bd[3], &bd[4], &bd[5]) =3D=3D 6)
{
- int i;
-
- BT_DATA("<--|X| %3d\n", len);
-
- BT_DATADUMP("<--|X|", data, len);
- i =3D write(phys_fd, data, len);
- return i;
+ parseok =3D 1;
}
-
-
-/* Only works for the last connected rfcomm session */
-int
-bt_write_top(char *buf, int count, int line)
-{
- int retval;
- int bytes_sent =3D 0;
-
- BT_DATA(" |X|<-- %3d [%d]\n", count, line);
- BT_DATADUMP("|X|<--", buf, count);
-
- while (bytes_sent!=3Dcount)
- {
- retval =3D rfcomm_send_data(CREATE_RFCOMM_ID(line,test_dlci),
- buf + bytes_sent, count-bytes_sent);
-
- if (retval > 0)
- bytes_sent+=3Dretval;
- else if (retval=3D=3D0)
- usleep(1000); /* wait some ... */
- else
+ else if (sscanf(src, "%x:%x:%x:%x:%x:%x",
+ &bd[0], &bd[1], &bd[2],
+ &bd[3], &bd[4], &bd[5]) =3D=3D 6)
{
- printf("error\n");
- return retval;
- }
-
- usleep(1000); /* wait some time ... */
- };
-
- bt_stat.bytes_sent+=3Dbytes_sent;
-
- return bytes_sent;
+ parseok =3D 1;
}
=20
-int bt_receive_top(rfcomm_con *rfcomm, unsigned char *data, int len)
-{
- int n =3D 0;
-
- BT_DATA(" |X|--> %3d [%d]\n", len, rfcomm->line);
- BT_DATADUMP("|X|-->", data, len);
-
-#if 0 /* fixme */
- if (modem_emulation && !modem_connected)
+ if(parseok)
{
- modem_emulator(0xb055e, data, len);
- return len;
- }
-
- /* FIXME<2> -- why is data echoed back if no application is
- running on top of PTY ?? */
-
- if (!ready_for_ppp)
- return len;
-
- /* feed this to PTY connected to pppd or whatever application
- that may be running there... */
-
- if ((n =3D write(pty_master_fd, data, len)) !=3D len)
+ for(i =3D 0 ; i < 6 ; i++)
{
- BT_DATA(__FUNCTION__ ": tried to write %d bytes, wrote %d\n", len, n);
+ dst[i] =3D bd[i];
}
-#endif
-
- bt_stat.bytes_received+=3Dn;
-
- return n;
+ return 0;
}
-
-void
-bt_connect_ind(unsigned int con_id)
-{
- if (GET_PSM(con_id) =3D=3D RFCOMM_LAYER)
- printf(__FUNCTION__ ": RFCOMM dlci : %d\n",
- GET_RFCOMMDLCI(con_id));
else
- printf(__FUNCTION__ ": psm %d\n", GET_PSM(con_id));
-}
-
-void
-bt_connect_cfm(unsigned int con_id, int status)
{
- unsigned short psm;
- int line;
-
- psm =3D GET_PSM(con_id);
-
- if (status)
- {
- /* fixme -- only works for rfcomm now */
- line =3D GET_LINE(con_id);
-
- if ((line < 0) || (line > BT_NBR_DATAPORTS))
- {
- fprintf(stderr, __FUNCTION__ ": Invalid line (%d)\n", line);
- return;
- }
- fprintf(stderr, __FUNCTION__": Failed, status %d [%s] line %d\n", stat=
us, psmname(psm), line);
-
- return;
- }
-
- switch (psm)
- {
- case RFCOMM_LAYER:
- printf(__FUNCTION__ ": [%s]\n", psmname(psm));
- break;
-
- case SDP_LAYER:
- printf(__FUNCTION__ ": [%s]\n", psmname(psm));
- break;
-
- case TCS_LAYER:
- printf(__FUNCTION__ ": [%s]\n", psmname(psm));
- break;
-
- default:
- printf(__FUNCTION__ ": unknown layer %d\n", psm);
- break;
- }
-}
-
-void
-bt_disconnect_ind(unsigned int con_id)
-{
- if (GET_PSM(con_id) =3D=3D RFCOMM_LAYER)
- printf(__FUNCTION__ ": RFCOMM dlci : %d\n", GET_RFCOMMDLCI(con_id));
- else
- printf(__FUNCTION__ ": psm %d\n", GET_PSM(con_id));
+ return -1;
}
-
-int
-bt_register_rfcomm(struct rfcomm_con *rfcomm, u8 dlci)
-{
- printf(__FUNCTION__ ": dlci %d\n", dlci);
- test_rfcomm =3D rfcomm;
- test_dlci =3D dlci;
- return 0;
}
=20
-s32
-bt_unregister_rfcomm(s32 line)
-{
- printf(__FUNCTION__ ": line %d\n", line);
- /* fixme -- stub for now */
-}
=20
-s32
-bt_register_sdp(u8 line, u8 sdpID)
-{
- printf(__FUNCTION__ "\n");
- return 0;
-}
=20
-s32 bt_unregister_sdp(s32 line)
-{
- printf(__FUNCTION__ "\n");
- return 0;
-}
=20
-int bt_initiated(void)
-{
- return bt_initdone;
-}
-#endif /* BT_USERSTACK */
--- bt_if.h 2003/11/05 15:24:05 1.3
+++ bt_if.h 2003/11/05 19:04:53 1.4
@@ -42,10 +42,6 @@
#ifndef __BT_IF_H__
#define __BT_IF_H__
#include <sys/types.h>
-#ifdef BT_USERSTACK
-#include <pthread.h>
-#include "include/rfcomm.h"
-#endif
=20
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
/* General defines */
@@ -83,18 +79,11 @@
=20
#define PID_FILE "/var/run/btd.pid"
=20
-#ifdef BT_USERSTACK
-#define SDPSRV_CMD "sdp_user"
-#define SDPSRV_PROC "/tmp/sdp_sock"
-#else
#define SDPSRV_CMD "sdp_server"
#define SDPSRV_PROC "/proc/sdp_srv"
-#endif
-
-#define SDPSRV_CONF "/etc/sdp.xml"
=20
=20
-#ifndef BT_USERSTACK
+#define SDPSRV_CONF "/etc/sdp.xml"
=20
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
/* IF Macros */
@@ -143,6 +132,9 @@
#define BTREADREMOTENAME _IOWR(BT_IOC_MAGIC, 0x12, unsigned char[BT_NAME_L=
ENGTH])
#define BTREADREMOTECLASSOFDEV _IOWR(BT_IOC_MAGIC, 0x13, unsigned char[6])
=20
+/* Disconnect all connections */
+#define BTDISCONNECT_ALL _IO(BT_IOC_MAGIC, 0x14)
+
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
/* Ioctls for executing HCI commands */
=20
@@ -307,8 +299,6 @@ typedef struct ping_struct
unsigned char data[1024];
} ping_struct;
=20
-#endif /* BT_USERSTACK */
-
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
/* Functions common to both usermode and kernel stack */
=20
@@ -319,9 +309,7 @@ typedef struct ping_struct
int init_stack(int bt_cfd, char * local_name);
int bt_isinitiated(int bt_cfd);
void shutdown_stack(int bt_cfd);
-#ifndef BT_USERSTACK
char* bt_hw_vendor(void);
-#endif
char* bt_firmware_info(void);
int bt_bcsp_mode(int bt_cfd, int enable);
int bt_dfu_mode(int bt_cfd, int enable);
@@ -332,13 +320,11 @@ void set_bt_line_disc(int phys_fd, int b
/*
* BNEP functions
*/
-#ifndef BTD_USERSTACK
int bnep_connect(int bt_fd, unsigned char *bd,=20
int srcservice, int dstservice,
unsigned char *pin, int pinlen);
=20
void bnep_disconnect(int bt_fd, unsigned char *bd);
-#endif
=20
/*
* Connect/Disconnect functions
@@ -347,7 +333,8 @@ void bnep_disconnect(int bt_fd, unsigned
int bt_connect(int bt_fd, unsigned char *bd, unsigned int con_id,=20
unsigned char *pin, unsigned char pinlen);
int bt_disconnect(int bt_fd, unsigned int con_id);
-int bt_disconnect_bb(int bt_fd, unsigned char *rem_bd); /* (Consafe) */
+int bt_disconnect_bb(int bt_fd, unsigned char *rem_bd);=20
+int bt_disconnect_all(int bt_cfd);
=20
void bt_waitline(int bt_fd, int line);
void bt_waitconnection(int bt_fd, int line);
@@ -422,37 +409,7 @@ int open_device(char* dev, int flags, in
void close_device(int fd);
const char *error_msg(int err);
int start_sdp_server(void);
+int strtobd(unsigned char *src, unsigned char *dst);
=20
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
-/* Functions only used in usermode stack */
-
-#ifdef BT_USERSTACK
-
-const char* psmname(unsigned short psm);
-int bt_write_lower_driver(unsigned char *data, int len);
-int bt_write_top(char *buf, int count, int line);
-int bt_receive_top(rfcomm_con *rfcomm, unsigned char *data, int len);
-void bt_rfcomm_connection_ready(int status);
-void bt_sdp_connection_ready(int status);
-int bt_initiated(void);
-extern int bt_read_proc(char *buf, int len);
-void init_userstack();
-
-#ifdef BT_USERSTACK
-int bt_register_rfcomm(struct rfcomm_con *rfcomm, unsigned char dlci);
-void bt_connect_cfm(unsigned int con_id, int status);
-#endif
-
-/* FIXME<1> clean this up !!! */
-bt_stat_struct bt_stat;
-
-/* Thread used to read data on "physical" device i.e where BT HW sits */
-pthread_t read_thread;
-int init_read_thread(void);
-void hci_receive_thread(void);
-
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
-
-#endif
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
#endif /* __BT_IF_H__ */
--- bt_misc.c 2003/11/04 10:59:39 1.1
+++ bt_misc.c 2003/11/05 19:04:53 1.2
@@ -551,7 +551,6 @@ bd2str(const unsigned char *bd)
return buf;
}
=20
-#ifndef BT_USERSTACK
void=20
print_data(const char *message, const unsigned char *buf, int len)
{=20
@@ -572,7 +571,6 @@ print_data(const char *message, const un
printf("\n");
}
}
-#endif
=20
/* Sets pin code to string pin, disabled if using 'disable' as pin */
void
--- bt_misc.h 2003/11/04 10:59:39 1.1
+++ bt_misc.h 2003/11/05 19:04:53 1.2
@@ -68,9 +68,7 @@ char *get_local_ip_address(void);
char* get_domain_name(void);
=20
const char *bd2str(const unsigned char *bd);
-#ifndef BT_USERSTACK
void print_data(const char *message, const unsigned char *buf, int len);
-#endif
void set_pin_code(const char *pin);
=20
#endif /* __BT_MISC_H__*/
|
|
From: Anders J. <and...@us...> - 2003-11-05 21:28:55
|
The following file was modified in apps/bluetooth/utils/btconnect:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
btcon.c 1.2 1.3=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Replaced BD parsing with library function.
The diff of the modified file(s):
--- btcon.c 2003/11/05 17:04:33 1.2
+++ btcon.c 2003/11/05 19:05:42 1.3
@@ -139,7 +139,7 @@ main(int argc, char **argv)
{
char *bd_str =3D NULL;
unsigned char bd[6];
- int opt, i, result =3D 0;
+ int opt, result =3D 0;
=20=20=20
int line =3D DEFAULT_LINE;
int srvch =3D 1;
@@ -160,38 +160,10 @@ main(int argc, char **argv)
{
case 'a':
{
- int tmp[6], all_read =3D 0;
bd_str =3D optarg;
- if (sscanf(optarg, "%2x%2x%2x%2x%2x%2x",
- &tmp[0], &tmp[1], &tmp[2],
- &tmp[3], &tmp[4], &tmp[5]) =3D=3D 6)
- {=20=20
- all_read =3D 1;
- }
- else if (sscanf(optarg, "%x:%x:%x:%x:%x:%x",
- &tmp[0], &tmp[1], &tmp[2],
- &tmp[3], &tmp[4], &tmp[5]) =3D=3D 6)
- {=20=20
- all_read =3D 1;
- }
- else if (sscanf(optarg, "%x-%x-%x-%x-%x-%x",
- &tmp[0], &tmp[1], &tmp[2],
- &tmp[3], &tmp[4], &tmp[5]) =3D=3D 6)
- {=20
- all_read =3D 1;
- }
-=20=20=20=20=20=20=20=20
- /* now convert to real bd format if syntax was correct */
- if (all_read)
- {
- for (i =3D 0; i < 6; i++)
- {
- bd[i] =3D (unsigned char)tmp[i];=20
- }
- }
- else
+ if(strtobd(optarg, bd) < 0)
{
- fprintf(stderr, "Invalid syntax: %s\n", bd_str);
+ fprintf(stderr, "Invalid syntax: %s\n", optarg);
usage();
exit(1);
}
|
|
From: Anders J. <and...@us...> - 2003-11-05 21:27:46
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
bluetooth.c 1.241 1.242=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Added BT_DISCONNECT_ALL IOCTL to disconnect all connections.
The diff of the modified file(s):
--- bluetooth.c 2003/11/05 17:03:14 1.241
+++ bluetooth.c 2003/11/05 19:03:12 1.242
@@ -651,6 +651,20 @@ __bt_ioctl(struct tty_struct *tty, struc
return lp_disconnect(con_str->hci_hdl, 1);
}
=20
+ case BTDISCONNECT_ALL:
+ {
+=09=09
+ /* Disconnect all connections */
+ s32 i;
+ for (i =3D 0 ; i < MAX_NBR_OF_CONNECTIONS ; i ++) {
+ if (hci_ctrl.con[i].state !=3D NOT_CONNECTED) {
+ lp_disconnect(hci_ctrl.con[i].con_hdl, 1);
+ }
+ }
+ return 0;
+ }
+=09
+
case BTWAITFORCONNECTION:
{
s32 line;
|
|
From: Anders J. <and...@us...> - 2003-11-05 21:27:40
|
The following files were modified in linux/drivers/char/bluetooth:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
bluetooth.c 1.240 1.241=20=20=20=20=20=20=20=20=20=20=20=20=
=20
bnep.c 1.19 1.20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20
bnep_status_proc.c 1.3 1.4=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20
The accompanying log:
Made it possible to specify source and target role for bnep connect.
The diff of the modified file(s):
--- bluetooth.c 2003/11/05 15:21:58 1.240
+++ bluetooth.c 2003/11/05 17:03:14 1.241
@@ -1548,7 +1548,8 @@ hci_inq_exit0:
BT_DRIVER("Using src UUID 0x%04x and dst UUID 0x%04x\n", btcon.bnep_src_=
uuid,
btcon.bnep_dst_uuid);
=20=09=09
- tmp =3D bnep_connect_req(btcon.bd, &btcon.pincode);
+ tmp =3D bnep_connect_req(btcon.bd, &btcon.pincode, btcon.bnep_src_uuid,=
=20
+ btcon.bnep_dst_uuid);
=20
result[0] =3D (tmp>>8)&0x0ff; // conn hdl
result[1] =3D (tmp>>16)&0x0ff; // conn hdl
--- bnep.c 2003/11/05 15:21:58 1.19
+++ bnep.c 2003/11/05 17:03:14 1.20
@@ -114,11 +114,15 @@
#define BNEP_INTERFACES 7
#define MAX_EHEADERS 20
=20
+#define DEFAULT_ROLE UUID_NAP
+
/****************** TYPE DEFINITION SECTION ******************************=
***/
=20
/****************** GLOBAL VARIABLE DECLARATION SECTION ******************=
***/
=20
static s32 result_param_bnep;
+static u16 role =3D 0;
+static u16 remote_role =3D 0;
=20
/*************************** UPF TEST VARS *******************************=
***/
extern int dont_send_reply;
@@ -299,6 +303,8 @@ bnep_init_interface(struct net_device *d
=20=09
local->state =3D DISCONNECTED;
local->magic =3D BNEP_MAGIC_NUMBER;
+ local->role =3D DEFAULT_ROLE;
+ local->remote_role =3D 0;
=20=09
dev->irq =3D 0;
dev->dma =3D 1;
@@ -1068,6 +1074,7 @@ bnep_control(l2cap_con *l2cap, u8 *data,
source_uuid =3D be16_to_cpu(*(u16*)&data[src_pos + uuid_length]);
D_MISC("UUID length: %x, dest uuid: %02lx, source uuid: %02lx\n",
data[0], destination_uuid, source_uuid);
+ local->remote_role =3D source_uuid;
/* Lets compare destination uuid, dont care about source uuid */
if (destination_uuid =3D=3D UUID_NAP || destination_uuid =3D=3D UUID_GN=
) {=09
D_MISC("uuids are matching, enter connected state\n");
@@ -1418,6 +1425,7 @@ bnep_connect_ind(l2cap_con *l2cap)=20
result_param_bnep =3D ((l2cap->hci_hdl<<8)&0x0ffff00) + ((i<<24)&0=
xff000000);
local->state =3D BNEP_CONFIG;
local->initiator =3D 0;
+ local->role =3D DEFAULT_ROLE;
l2cap->upper_con =3D (void *)&dev_bnep[i];
=20
result_param_bnep &=3D 0xffffff00;
@@ -1453,6 +1461,8 @@ bnep_connect_cfm(l2cap_con *l2cap, s32 s
local->l2cap =3D l2cap;
local->state =3D BNEP_CONFIG;
local->initiator =3D 1;
+ local->role =3D role;
+ local->remote_role =3D remote_role;
l2cap->upper_con =3D (void *)&dev_bnep[i];
break;
}=20
@@ -1600,10 +1610,12 @@ bnep_setup_connection(struct net_local *
}
=20
u32
-bnep_connect_req(u8 *bd_addr, bt_pincode *pincode)=20
+bnep_connect_req(u8 *bd_addr, bt_pincode *pincode, u16 src_role, u16 dst_r=
ole)=20
{
DSYS("BNEP: Connect request %02x:%02x:%02x:%02x:%02x:%02x\n",
bd_addr[0],bd_addr[1],bd_addr[2],bd_addr[3],bd_addr[4],bd_addr[5]);
+ role =3D src_role;
+ remote_role =3D dst_role;
=20=09
if (l2ca_connect_req(bd_addr, BNEP_LAYER, pincode)) {
D_ERR(__FUNCTION__": l2ca_connect_req failed\n");
--- bnep_status_proc.c 2003/01/22 13:33:49 1.3
+++ bnep_status_proc.c 2003/11/05 17:03:14 1.4
@@ -117,6 +117,12 @@
static s32
bnep_status_proc_read(char *buf, char **start, off_t offset, int len);
=20
+static u8 *
+bnep_statetostr(int state);
+
+static u8 *
+bnep_roletostr(int role);
+
/****************** LOCAL VARIABLE DECLARATION SECTION *******************=
***/
=20
#ifdef __KERNEL__
@@ -201,23 +207,7 @@ int bnep_status_proc_read(char *buf, int
local =3D dev_bnep[i].priv;
if (local->state !=3D DISCONNECTED) {
len +=3D sprintf(buf + len,"%s State =3D ",dev_bnep[i].name);
- switch (local->state) {
- case DISCONNECTED:
- len +=3D sprintf(buf + len, "DISCONNECTED ");
- break;
- case BNEP_CONFIG:
- len +=3D sprintf(buf + len, "CONFIG ");
- break;
- case SETUP:
- len +=3D sprintf(buf + len, "SETUP ");
- break;
- case CONNECTED:
- len +=3D sprintf(buf + len, "CONNECTED ");
- break;
- default:
- len +=3D sprintf(buf + len, "UNKNOWN ");
- }
-=09=09=09
+ len +=3D sprintf(buf + len, "%s", bnep_statetostr(local->state));
if (local->l2cap !=3D NULL) {
len +=3D sprintf(buf +len," Remote BD %02x:%02x:%02x:%02x:%02x:%02x",
local->l2cap->remote_bd[5],local->l2cap->remote_bd[4],
@@ -228,6 +218,9 @@ int bnep_status_proc_read(char *buf, int
//...
}
=20=09=09=09
+ len +=3D sprintf(buf + len, " Role: %s Remote role: %s", bnep_roletostr=
(local->role),
+ bnep_roletostr(local->remote_role));
+
len +=3D sprintf(buf + len,=20
"\n Stats: tx_packets %ld tx_bytes %ld tx_dropped %ld "
"rx_packets %ld rx_bytes %ld rx_dropped %ld\n",
@@ -269,4 +262,29 @@ bnep_status_proc_write(struct file *f, c
{
D_PROC(__FUNCTION__ " Someone wrote %d bytes to bnep proc-file\n", count);
return 0;
+}
+
+static u8 *
+bnep_statetostr(int state)
+{
+ switch (state)
+ {
+ case DISCONNECTED: return "DISCONNECTED ";
+ case BNEP_CONFIG: return "CONFIG ";
+ case SETUP: return "SETUP ";
+ case CONNECTED: return "CONNECTED ";
+ default: return "UNKNOWN ";
+ }
+}=09
+
+static u8 *
+bnep_roletostr(int role)
+{
+ switch(role)
+ {
+ case UUID_PANU: return "PANU ";
+ case UUID_NAP: return "NAP ";
+ case UUID_GN: return "GN ";
+ default: return "Unknown ";
+ }
}
|
|
From: Anders J. <and...@us...> - 2003-11-05 21:27:30
|
The following file was modified in apps/bluetooth/utils/btdisc:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
btdisc.c 1.1 1.2=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Added option to disconnect all connections.
The diff of the modified file(s):
--- btdisc.c 2003/11/04 10:59:38 1.1
+++ btdisc.c 2003/11/05 19:06:16 1.2
@@ -69,6 +69,20 @@
* bd_address_string example : 00:40:8c:cd:00:00=20=20
*/
=20
+void
+usage()
+{
+ printf("btdisc [-d <dev>] -D <rfcomm dlci>\n");
+ printf("btdisc -a <bd_address>\n");
+ printf("btdisc -A\n");
+ printf("Options:\n");
+ printf(" <dev> Specify device (default: %s)\n", DEFAULT_BTDEV);
+ printf(" <rfcomm dlci> Specify dlci\n");
+ printf(" <bd_address> Bd address to disconnect\n");
+ printf(" -A Disconnect all connections\n");
+}
+
+
int
main(int argc, char **argv)
{
@@ -76,8 +90,7 @@ main(int argc, char **argv)
int con_id, bt_cfd, dlci =3D -1, line, opt;
int result =3D 0;
unsigned char bd[6];
- int i, use_bd =3D 0, error =3D 0;
- int tmp[6];
+ int use_bd =3D 0, use_all =3D 0;
=20
/* Print header if called via http */
if (getenv("REQUEST_METHOD") !=3D NULL)
@@ -86,7 +99,7 @@ main(int argc, char **argv)
}
=20=20=20
/* now parse options */
- while ((opt =3D getopt(argc, argv, "a:d:D:")) !=3D -1)
+ while ((opt =3D getopt(argc, argv, "a:d:D:A")) !=3D -1)
{
switch (opt)
{
@@ -102,38 +115,28 @@ main(int argc, char **argv)
break;
=20=20=20=20=20=20=20
case 'a':
- if (sscanf(optarg, "%2x:%2x:%2x:%2x:%2x:%2x",
- &tmp[0], &tmp[1], &tmp[2],
- &tmp[3], &tmp[4], &tmp[5]) =3D=3D 6)
- {=20
- for (i =3D 0; i < 6; i++)
+ if(strtobd(optarg, bd) < 0)
{
- bd[i] =3D (unsigned char)tmp[i];=20
+ fprintf(stderr, "Invalid syntax: %s\n", optarg);
+ usage();
+ exit(1);
}=20=20=20=20=20=20
-=20=20=20=20=20=20=20=20
- D(syslog(LOG_INFO,"Rem. Address:%2x:%2x:%2x:%2x:%2x:%2x\n",
- bd[0], bd[1], bd[2],
- bd[3], bd[4], bd[5]));
use_bd =3D 1;
- }=20
- else=20
- {
- error =3D 1;
- }=20=20
break;
=20
+ case 'A':
+ use_all =3D 1;
+ break;
=20=20=20=20=20=20=20
default:
break;
}
}
=20
- if (optind < argc || (dlci < 0 && !use_bd) || error)
+ if (!use_all && !use_bd && (dlci < 0))
{
- printf("Wrong syntax or missing parameters\n");
- printf("Syntax: %s [-d <dev>] -D <rfcomm dlci>\n", argv[0]);
- printf(" %s -a <BD address>\n", argv[0]);
- exit(0);
+ usage();=20=20=20=20=20=20
+ exit(1);
}
=20
/* Open BT ctrl device */=20=20
@@ -146,27 +149,33 @@ main(int argc, char **argv)
/* First of all check that stack is running */
if (!bt_isinitiated(bt_cfd))
{
- printf("Stack not initiated, exit\n");
+ fprintf(stderr, "Stack not initiated, exit\n");
exit(1);
}
=20=20=20
- if(!use_bd)=20
+ if(!use_bd && !use_all)=20
{
line =3D atoi((char*)(btdev+10));
=20=20=20
/* Disconnect RFCOMM session on line */
printf("Disconnecting line %d [%s]\n", line, btdev);
- D(syslog(LOG_INFO,"Disconnecting line %d [%s]\n", line, btdev));
=20
con_id =3D CREATE_RFCOMM_ID(line, dlci);
=20
result =3D bt_disconnect(bt_cfd, con_id);=20=20
}=20
- else=20
+ else if(use_bd)
{
/* Disconnect any connection which match the remote bd, i.e. the baseb=
andconnection */
- bt_disconnect_bb(bt_cfd, bd);
+ result =3D bt_disconnect_bb(bt_cfd, bd);
+ }=20
+ else if(use_all)=20
+ {
+ result =3D bt_disconnect_all(bt_cfd);
}
+=20=20=20=20
close(bt_cfd);
+ if(result)
+ fprintf(stderr, "Failed\n");
exit(result);
}
|
|
From: Anders J. <and...@us...> - 2003-11-05 19:10:45
|
The following file was modified in linux/include/linux/bluetooth: Name Old version New version Tag Comment ---- ----------- ----------- --- ------- btcommon.h 1.101 1.102=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Added BT_DISCONNECT_ALL The diff of the modified file(s): --- btcommon.h 2003/11/05 15:22:54 1.101 +++ btcommon.h 2003/11/05 19:03:45 1.102 @@ -151,6 +151,7 @@ #define BTDISCONNECT_BB _IOW(BT_IOC_MAGIC, 0x11, u8[6]) #define BTREADREMOTENAME _IOWR(BT_IOC_MAGIC, 0x12, u8[BT_NAME_LENGTH]) #define BTREADREMOTECLASSOFDEV _IOWR(BT_IOC_MAGIC, 0x13, u8[6]) +#define BTDISCONNECT_ALL _IO(BT_IOC_MAGIC, 0x14) =20 /* Ioctls executing HCI commands */ =20 |
|
From: Anders J. <and...@us...> - 2003-11-05 17:12:06
|
The following files were modified in linux/include/linux/bluetooth:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
bnep.h 1.8 1.9=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20
bnep_internal.h 1.3 1.4=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20
The accompanying log:
Added bnep role parameters.
The diff of the modified file(s):
--- bnep.h 2003/11/05 15:22:54 1.8
+++ bnep.h 2003/11/05 17:05:59 1.9
@@ -331,7 +331,8 @@ int bnep_init_module(void);
void bnep_exit_module(void);
void bnep_init(void);
void bnep_shutdown(void);
-u32 bnep_connect_req(u8* bd_addr, bt_pincode *pincode);
+u32 bnep_connect_req(u8* bd_addr, bt_pincode *pincode, u16 src_role,=20
+ u16 dst_role);
u32 bnep_disconnect_req(u8* bd_addr);
u32 bnep_test(u8 *p);
void bnep_set_mac_address_all(u8 *addr);
--- bnep_internal.h 2002/04/08 10:04:44 1.3
+++ bnep_internal.h 2003/11/05 17:05:59 1.4
@@ -81,6 +81,8 @@ typedef struct net_local=20
struct macaddr mc_list[BNEP_MAX_MULTI];
u8 proc_msg_buf[256];
u8 bd_addr[6];
+ u16 role;
+ u16 remote_role;
} __attribute__ ((packed)) net_local;
=20
extern struct net_device dev_bnep[7];=20=20
|
|
From: Anders J. <and...@us...> - 2003-11-05 17:10:45
|
The following file was modified in apps/bluetooth/utils/btconnect:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
btcon.c 1.1 1.2=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Added bnep for btcon. Pincode shall now work properly. Added usage-page.
The diff of the modified file(s):
--- btcon.c 2003/11/04 10:59:38 1.1
+++ btcon.c 2003/11/05 17:04:33 1.2
@@ -60,21 +60,92 @@
#include "bt_if.h"
#include "bt_misc.h"
=20
-#define DEFAULT_BTDEV "/dev/ttyBT0"
+#define DEFAULT_PROTOCOL "RFCOMM"
+#define DEFAULT_LINE 0 /* /dev/ttyBT0 */
+#define DEFAULT_SRV_CHANNEL 1
+#define DEFAULT_DEST 0x1116 /* NAP */
+#define DEFAULT_SRC 0x1115 /* PANU */
=20
-/*
- * Syntax: btcon [-d <device>] [-p <pincode>] -a <BD> [-S <rfcomm srv ch>]
- * If using 'disable' as pin, authentication is disabled=20
- */
+static int bt_cfd;
+unsigned char *pin =3D "";
+
+static void usage();
+static int connect_rfcomm(unsigned char *bd,=20
+ int srv_channel,=20
+ int line);
+static int connect_bnep(unsigned char *bd,
+ int dest,
+ int src);
+
+static void
+usage()
+{
+ printf("btcon -a <BD> [-p <pincode>] [-P <protocol RFCOMM/BNEP>]\n");
+ printf("RFCOMM protocol:\n");
+ printf(" [-s <rfcomm srv channel>]\n");
+ printf(" [-d <device>]\n");
+ printf("BNEP protocol:\n");
+ printf(" [-D <destination service>]\n");
+ printf(" [-S <source service>]\n");
+ printf("Default values:\n");
+ printf(" -P %s\n", DEFAULT_PROTOCOL);
+ printf(" -s %d\n", DEFAULT_SRV_CHANNEL);
+ printf(" -d /dev/ttyBT%d\n", DEFAULT_LINE);
+ printf(" -D 0x%04x\n", DEFAULT_DEST);
+ printf(" -S 0x%04x\n", DEFAULT_SRC);
+}
+
+static int=20
+connect_rfcomm(unsigned char *bd,
+ int srv_channel,
+ int line)
+{=20
+ int con_id;
+=20=20
+ /* Connect RFCOMM session on line */
+ printf("Connecting to %s on line %d\n", bd2str(bd), line);
+
+ /* Some sanity checks */
+ if ((srv_channel <=3D 0) || (srv_channel > 62))=20
+ {
+ fprintf(stderr, "Invalid server channel\n");
+ exit(1);
+ }
+
+ if((line < 0) || (line > 6))
+ {
+ fprintf(stderr, "Invalid device\n");
+ exit(1);
+ }
+
+ con_id =3D CREATE_RFCOMM_ID(line, srv_channel << 1);
+ return bt_connect(bt_cfd, bd, con_id, pin, strlen(pin));
+}
+
+static int
+connect_bnep(unsigned char *bd,
+ int dest,
+ int src)
+{
+ printf("Connecting with BNEP using source UUID 0x%04x and dest UUIS 0x%0=
4x\n",
+ src, dest);
+ return bnep_connect(bt_cfd, bd,=20
+ src, dest,
+ pin, strlen(pin));
+}
=20
int
main(int argc, char **argv)
{
- char *btdev =3D DEFAULT_BTDEV;
char *bd_str =3D NULL;
unsigned char bd[6];
- int con_id, opt, i, result;
- int line, bt_cfd, srvch =3D 1;
+ int opt, i, result =3D 0;
+=20=20
+ int line =3D DEFAULT_LINE;
+ int srvch =3D 1;
+ int dstservice =3D DEFAULT_DEST;
+ int srcservice =3D DEFAULT_SRC;
+ unsigned char *protocol =3D DEFAULT_PROTOCOL;=20
=20
/* Print header if called via http */
if (getenv("REQUEST_METHOD") !=3D NULL)
@@ -83,7 +154,7 @@ main(int argc, char **argv)
}
=20
/* now parse options */
- while ((opt =3D getopt(argc, argv, "a:d:r:S:p:")) !=3D -1)
+ while ((opt =3D getopt(argc, argv, "a:d:r:S:p:D:s:S:P:h")) !=3D -1)
{
switch (opt)
{
@@ -117,12 +188,11 @@ main(int argc, char **argv)
{
bd[i] =3D (unsigned char)tmp[i];=20
}
- printf("Connecting to bd: %2x:%2x:%2x:%2x:%2x:%2x\n",
- bd[0], bd[1], bd[2], bd[3], bd[4], bd[5]);
}
else
{
- printf("Invalid syntax: %s\n", bd_str);
+ fprintf(stderr, "Invalid syntax: %s\n", bd_str);
+ usage();
exit(1);
}
}
@@ -130,19 +200,74 @@ main(int argc, char **argv)
=20=20=20=20=20=20=20
case 'd':
/* BT device */
- btdev =3D optarg;
- printf("btdev %s\n", btdev);
+ if(sscanf(optarg, "/dev/ttyBT%d", &line) !=3D 1)
+ {
+ fprintf(stderr, "Invalid device %s\n", optarg);
+ exit(1);
+ }
break;
=20=20=20=20=20=20=20
- case 'p':
- /* If using 'disable' as pin, authentication is disabled */
- printf("Using pin code: %s\n", optarg);
- set_pin_code(optarg);
+ case 's':
+ srvch =3D atoi(optarg);
break;
=20
case 'S':
- srvch =3D atoi(optarg);
- printf("Using rfcomm server ch: %d\n", srvch);
+ if(sscanf(optarg, "0x%x", &srcservice) =3D=3D 1)
+ {
+ }
+ else if(!strcmp(optarg, "PANU"))
+ {
+ srcservice =3D 0x1115;
+ }
+ else if(!strcmp(optarg, "NAP"))
+ {
+ srcservice =3D 0x1116;
+ }
+ else if(!strcmp(optarg, "GN"))
+ {
+ srcservice =3D 0x1117;
+ }
+ else
+ {
+ fprintf(stderr, "Invalid source service for BNEP\n");
+ exit(1);
+ }
+ break;
+
+ case 'D':
+ if(sscanf(optarg, "0x%x", &dstservice) =3D=3D 1)
+ {
+ }
+ else if(!strcmp(optarg, "PANU"))
+ {
+ dstservice =3D 0x1115;
+ }
+ else if(!strcmp(optarg, "NAP"))
+ {
+ dstservice =3D 0x1116;
+ }
+ else if(!strcmp(optarg, "GN"))
+ {
+ dstservice =3D 0x1117;
+ }
+ else
+ {
+ fprintf(stderr, "Invalid source service for BNEP\n");
+ exit(1);
+ }
+ break;
+=20=20=20=20=20=20
+ case 'p':
+ pin =3D optarg;
+ break;
+
+ case 'h':
+ usage();
+ exit(0);
+ break;
+=20=20=20=20=20=20
+ case 'P':
+ protocol =3D optarg;
break;
=20=20=20=20=20=20=20
default:
@@ -152,8 +277,8 @@ main(int argc, char **argv)
=20
if (optind < argc || !bd_str)
{=20=20=20=20
- printf("Wrong syntax or missing parameters\n");
- printf("Syntax: %s [-d <device>] [-p <pincode>] -a <BD> [-S <rfcomm sr=
v ch>]\n", argv[0]);
+ fprintf(stderr, "Wrong syntax or missing parameters\n");
+ usage();
exit(1);
}
=20
@@ -167,27 +292,23 @@ main(int argc, char **argv)
/* First of all check that stack is running */
if (!bt_isinitiated(bt_cfd))
{
- printf("Stack not initiated, exit\n");
+ fprintf(stderr, "Stack not initiated, exit\n");
exit(1);
}
=20
- line =3D atoi((char*)(btdev+10));
-=20=20
- /* Connect RFCOMM session on line */
-=20
- printf("Connecting to %s on line %d\n", bd2str(bd), line);
-
- /* Some sanity checks */
- if ((srvch <=3D 0) || (srvch > 62) || (line < 0) || (line > 6))
+ if(!strcmp(protocol, "RFCOMM"))
{
- printf("Invalid parameters, srvch [1-62] , line [0-6]\n");
- exit(1);
+ result =3D connect_rfcomm(bd, srvch, line);
+ }
+ else if(!strcmp(protocol, "BNEP"))
+ {
+ result =3D connect_bnep(bd, dstservice, srcservice);
+ }
+ else
+ {
+ fprintf(stderr, "Unknown protocol, exit\n");
+ usage();
}
-
- con_id =3D CREATE_RFCOMM_ID(line, srvch << 1);
-
- result =3D bt_connect(bt_cfd, bd, con_id);
-=20
close(bt_cfd);
exit(result);
}
|
|
From: Anders J. <and...@us...> - 2003-11-05 15:24:13
|
The following files were modified in libs/openbt:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
bt_errno.h 1.1 1.2=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
bt_if.c 1.2 1.3=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
bt_if.h 1.2 1.3=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Changed some ioctls.
Added possibllity to specify a pincode to use when connecting.
The diff of the modified file(s):
--- bt_errno.h 2003/11/04 10:59:39 1.1
+++ bt_errno.h 2003/11/05 15:24:05 1.2
@@ -87,6 +87,7 @@
#define RFCOMM_NO_DATA_ALLOWED 0xf2
#define RFCOMM_NO_CONNECTION 0xf3
#define RFCOMM_BAD_MAGIC_NUMBER 0Xf4
+#define RFCOMM_CONNECT_FAILED 0xf5
=20
/* fixme */
=20
--- bt_if.c 2003/11/04 15:24:30 1.2
+++ bt_if.c 2003/11/05 15:24:05 1.3
@@ -263,16 +263,16 @@ int bt_openctrl(void)
/* fixme<3> -- sdp connect */
=20
int
-bt_connect(int bt_fd, unsigned char *bd, unsigned int con_id)
+bt_connect(int bt_fd, unsigned char *bd, unsigned int con_id,
+ unsigned char *pin, unsigned char pinlen)
{
bt_connection con;
int result;
-#ifdef BT_USERSTACK
- unsigned short srv_ch;
- unsigned short line;
-#endif
=20
memcpy(con.bd, bd, 6);
+ memcpy(con.pincode.data, pin, MIN(pinlen, 0x10));
+ con.pincode.len =3D pinlen;
+=20=20
con.id =3D con_id;
switch(GET_PSM(con_id))
{
@@ -290,23 +290,11 @@ bt_connect(int bt_fd, unsigned char *bd,
return -1;
}
=20
-#ifndef BT_USERSTACK
+
if ((result =3D ioctl(bt_fd, BTCONNECT, &con)))
printf("Connect failed [%s (%d)]\n", error_msg(result), MSG_GET_CODE(-=
result));
else
printf("Connected.\n");
-#else
- {
- if ((GET_PSM(con_id) =3D=3D RFCOMM_LAYER) && ((con_id >> 8) & 0xff) !=
=3D 0)
- {
- printf("Use line 0 instead ! (usermode only)\n");
- return -1;
- }
-
-// printf("Connecting srv ch %d on line %d\n", srv_ch, line);
- result =3D bt_connect(bd, con_id);
- }
-#endif
return result;
}
=20
@@ -710,13 +698,22 @@ int bt_set_max_conections(int bt_cfd, in
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
/* BNEP functions */
=20
-void
-bnep_connect(int bt_fd, unsigned char *bd)
+int
+bnep_connect(int bt_fd, unsigned char *bd,=20
+ int srcservice, int dstservice,
+ unsigned char *pin, int pinlen)
{
- unsigned int result;
+ unsigned int result =3D 0;
+ bt_connection con;
+=20=20
+ memcpy(con.bd, bd, 6);
+ memcpy(con.pincode.data, pin, MIN(pinlen, 0x10));
+ con.pincode.len =3D pinlen;
+ con.bnep_src_uuid =3D srcservice;
+ con.bnep_dst_uuid =3D dstservice;
=20
#ifndef BTD_USERSTACK
- result =3D ioctl(bt_fd, BNEPCONNECT, bd);
+ result =3D ioctl(bt_fd, BNEPCONNECT, &con);
if (result&0x0ff)
{
printf("BNEP connect failed [%s ((0x%X))]\n",
@@ -730,6 +727,7 @@ bnep_connect(int bt_fd, unsigned char *b
#else
printf(__FUNCTION__ ": Unsupported in usermode\n");
#endif
+ return result;
}
=20
void
@@ -1537,6 +1535,7 @@ const char *error_msg(int err)
case RFCOMM_NO_DATA_ALLOWED: return "RFCOMM: No data allowed on contr=
ol channel";
case RFCOMM_NO_CONNECTION: return "RFCOMM: No connection";
case RFCOMM_BAD_MAGIC_NUMBER: return "RFCOMM: Bad magic number";
+ case RFCOMM_CONNECT_FAILED: return "RFCOMM: Couldn't connect, receive=
d DM";=20
default: return "RFCOMM: No debug msg defined";
}
case MSG_LAYER_SDP:
--- bt_if.h 2003/11/04 15:24:30 1.2
+++ bt_if.h 2003/11/05 15:24:05 1.3
@@ -41,7 +41,7 @@
=20
#ifndef __BT_IF_H__
#define __BT_IF_H__
-
+#include <sys/types.h>
#ifdef BT_USERSTACK
#include <pthread.h>
#include "include/rfcomm.h"
@@ -105,6 +105,8 @@
=20
#define GET_PSM(con_id) (con_id >> 16)
=20
+#define MIN(a,b) ((a) > (b) ? (b) : (a))=20=20
+
#define ANY_LINE 255
#define NO_LINE 256
=20
@@ -167,7 +169,7 @@
#define HCIHOLDMODE _IOW(BT_IOC_MAGIC, 0x5c, unsigned char[6])
=20
/* BNEP Control Commands */
-#define BNEPCONNECT _IOWR(BT_IOC_MAGIC, 0x29, unsigned char[6])
+#define BNEPCONNECT _IOWR(BT_IOC_MAGIC, 0x29, bt_connection)
#define BNEPTEST _IOW(BT_IOC_MAGIC, 0x2a, unsigned char[5])
#define BNEPADDPROTOCOLFILTER _IOW(BT_IOC_MAGIC, 0x2b, unsigned int[2])
#define BNEPADDMULTICASTFILTER _IOW(BT_IOC_MAGIC, 0x2c, unsigned char[12])
@@ -276,10 +278,19 @@
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
/* Structs */
=20
+typedef struct bt_pincode
+{
+ unsigned char len;
+ unsigned char data[0x10];
+} bt_pincode;
+
typedef struct bt_connection
{
unsigned char bd[6];
- unsigned int id; /* | psm(16 bits)=A0| layer_specific (16 bits)=A0|=A0*/
+ u_int32_t id; /* | psm(16 bits)=A0| layer_specific (16 bits)=A0|=A0*/
+ bt_pincode pincode;
+ u_int16_t bnep_src_uuid;
+ u_int16_t bnep_dst_uuid;
} bt_connection;
=20
typedef struct inquiry_results
@@ -322,7 +333,10 @@ void set_bt_line_disc(int phys_fd, int b
* BNEP functions
*/
#ifndef BTD_USERSTACK
-void bnep_connect(int bt_fd, unsigned char *bd);
+int bnep_connect(int bt_fd, unsigned char *bd,=20
+ int srcservice, int dstservice,
+ unsigned char *pin, int pinlen);
+
void bnep_disconnect(int bt_fd, unsigned char *bd);
#endif
=20
@@ -330,7 +344,8 @@ void bnep_disconnect(int bt_fd, unsigned
* Connect/Disconnect functions
*/
=20
-int bt_connect(int bt_fd, unsigned char *bd, unsigned int con_id);
+int bt_connect(int bt_fd, unsigned char *bd, unsigned int con_id,=20
+ unsigned char *pin, unsigned char pinlen);
int bt_disconnect(int bt_fd, unsigned int con_id);
int bt_disconnect_bb(int bt_fd, unsigned char *rem_bd); /* (Consafe) */
=20
|
|
From: Anders J. <and...@us...> - 2003-11-05 15:23:00
|
The following files were modified in linux/include/linux/bluetooth:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
bnep.h 1.7 1.8=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
bt_errno.h 1.6 1.7=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
btcommon.h 1.100 1.101=20=20=20=20=20=20=20=20=20=20=20=20=20
hci.h 1.81 1.82=20=20=20=20=20=20=20=20=20=20=20=20=20=20
l2cap.h 1.45 1.46=20=20=20=20=20=20=20=20=20=20=20=20=20=20
rfcomm.h 1.42 1.43=20=20=20=20=20=20=20=20=20=20=20=20=20=20
sdp.h 1.28 1.29=20=20=20=20=20=20=20=20=20=20=20=20=20=20
tcs.h 1.6 1.7=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
test.h 1.11 1.12=20=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* Added pincode per connection, used when we are initiating a connection
as we can't communicate with btsec if we are waiting for connection
complete.
* Changed some ioctls.
* Corrected RFCOMM if we recive a DM the waitqueue wasn't released.
* Added block/nonblock option to some HCI commands.
The diff of the modified file(s):
--- bnep.h 2003/01/09 09:55:06 1.7
+++ bnep.h 2003/11/05 15:22:54 1.8
@@ -331,7 +331,7 @@ int bnep_init_module(void);
void bnep_exit_module(void);
void bnep_init(void);
void bnep_shutdown(void);
-u32 bnep_connect_req(u8* bd_addr);
+u32 bnep_connect_req(u8* bd_addr, bt_pincode *pincode);
u32 bnep_disconnect_req(u8* bd_addr);
u32 bnep_test(u8 *p);
void bnep_set_mac_address_all(u8 *addr);
--- bt_errno.h 2001/10/22 12:57:13 1.6
+++ bt_errno.h 2003/11/05 15:22:54 1.7
@@ -86,7 +86,8 @@
#define RFCOMM_SRVCHN_CONNECTED 0xf1
#define RFCOMM_NO_DATA_ALLOWED 0xf2
#define RFCOMM_NO_CONNECTION 0xf3
-#define RFCOMM_BAD_MAGIC_NUMBER 0Xf4
+#define RFCOMM_BAD_MAGIC_NUMBER 0xf4
+#define RFCOMM_CONNECT_FAILED 0xf5
=20
/* fixme */
=20
--- btcommon.h 2003/04/14 08:45:34 1.100
+++ btcommon.h 2003/11/05 15:22:54 1.101
@@ -175,7 +175,7 @@
#define HCIHOLDMODE _IOW(BT_IOC_MAGIC, 0x5c, u8[6])
=20
/* BNEP Control Commands */
-#define BNEPCONNECT _IOWR(BT_IOC_MAGIC, 0x29, u8[6])
+#define BNEPCONNECT _IOWR(BT_IOC_MAGIC, 0x29, bt_connection)
#define BNEPTEST _IOW(BT_IOC_MAGIC, 0x2a, u8[5])
#define BNEPADDPROTOCOLFILTER _IOW(BT_IOC_MAGIC, 0x2b, u32[2])
#define BNEPADDMULTICASTFILTER _IOW(BT_IOC_MAGIC, 0x2c, u8[12])
@@ -339,6 +339,15 @@ typedef struct bt_timer_obj=20
#endif
} bt_timer_obj;
=20
+/* Pincode struct used when intiating a connection as sec manager only=20
+ can be used for incoming connections */
+typedef struct bt_pincode
+{
+ u8 len;
+ u8 data[0x10];
+} bt_pincode;
+
+
/****************** Some typedefs used in the l2cap_con struct ***********=
***/
=20
typedef u8 BD_ADDR[6];
@@ -396,6 +405,8 @@ typedef struct l2cap_con {
=20
u8 initiator;
=20
+ bt_pincode pincode;
+
u8 link_up;=20=20
u8 sig_id_sent; /* last sent command id */
u8 sig_id_rcv; /* last received command id */
@@ -497,6 +508,9 @@ typedef struct sdp_con{
typedef struct bt_connection{
u8 bd[6];
u32 id; /* | psm(16 bits)=A0| layer_specific (16 bits)=A0|=A0*/
+ bt_pincode pincode;
+ u16 bnep_src_uuid;
+ u16 bnep_dst_uuid;
} bt_connection;
=20
typedef struct bt_sdp_request
--- hci.h 2003/04/14 08:45:34 1.81
+++ hci.h 2003/11/05 15:22:54 1.82
@@ -140,10 +140,10 @@ int hci_inquiry(u8 lap[], u8 inq_len, u8
s32 hci_add_sco_connection(u32 hci_hdl);
=20
/* Link control commands */
-s32 hci_link_key_request_reply(u8 *bd, u8* link_key);
-s32 hci_link_key_request_negative_reply(u8 *bd);
-s32 hci_pin_code_request_reply(u8 *bd, u8 *pin, u8 pin_len);
-s32 hci_pin_code_request_negative_reply(u8 *bd);
+s32 hci_link_key_request_reply(u8 *bd, u8* link_key, u8 block);
+s32 hci_link_key_request_negative_reply(u8 *bd, u8 block);
+s32 hci_pin_code_request_reply(u8 *bd, u8 *pin, u8 pin_len, u8 block);
+s32 hci_pin_code_request_negative_reply(u8 *bd, u8 block);
s32 hci_authentication_requested(u16 con_hdl);
s32 hci_authentication_requested_bd(BD_ADDR bd);
s32 hci_set_connection_encryption(u16 con_hdl, u8 enable);
--- l2cap.h 2003/01/13 19:48:39 1.45
+++ l2cap.h 2003/11/05 15:22:54 1.46
@@ -361,7 +361,7 @@ void process_frame(struct l2cap_con *con
/* (E4) Upper layers to l2cap */
/*****************************/
=20
-s32 l2ca_connect_req(BD_ADDR bd, u16 psm);
+s32 l2ca_connect_req(BD_ADDR bd, u16 psm, bt_pincode *pincode);
s32 l2ca_connect_rsp(l2cap_con* con, u16 response,=20
u16 status);
=20
--- rfcomm.h 2001/10/22 12:57:13 1.42
+++ rfcomm.h 2003/11/05 15:22:54 1.43
@@ -191,7 +191,7 @@ typedef struct rpn_values{=20
s32 rfcomm_module_init(void);
void rfcomm_init(void);
void rfcomm_close(void);
-s32 rfcomm_connect_req(u8* bd_addr, u8 server_chan, u8 line);
+s32 rfcomm_connect_req(u8* bd_addr, u8 server_chan, u8 line, bt_pincode *p=
incode);
void rfcomm_connect_ind(l2cap_con *l2cap);
void rfcomm_connect_pnd(l2cap_con *l2cap, int status);
void rfcomm_connect_cfm(l2cap_con *l2cap, s32 status);
--- sdp.h 2001/10/22 12:57:13 1.28
+++ sdp.h 2003/11/05 15:22:54 1.29
@@ -82,7 +82,7 @@ void sdp_shutdown(void);
s32 sdp_create_proc_file(void);
s32 sdp_remove_proc_file(void);
#endif
-s32 sdp_connect_req(u8* bd_addr, u8 line);
+s32 sdp_connect_req(u8* bd_addr, u8 line, bt_pincode *pincode);
void sdp_connect_ind(l2cap_con *l2cap);
void sdp_connect_pnd(l2cap_con *l2cap, int status);
void sdp_connect_cfm(l2cap_con *l2cap, s32 status);
--- tcs.h 2001/02/15 16:28:47 1.6
+++ tcs.h 2003/11/05 15:22:54 1.7
@@ -72,7 +72,7 @@ typedef struct tcs_con {
/****************** EXPORTED FUNCTION DECLARATION SECTION ****************=
***/
void tcs_init(void);
void tcs_shutdown(void);
-s32 tcs_connect_req(u8 *bd);
+s32 tcs_connect_req(u8 *bd, bt_pincode *pincode);
void tcs_connect_ind(l2cap_con *l2cap);
void tcs_connect_cfm(l2cap_con *l2cap, s32 status);
void tcs_config_ind(l2cap_con* l2cap);
--- test.h 2001/10/16 16:24:51 1.11
+++ test.h 2003/11/05 15:22:54 1.12
@@ -64,8 +64,8 @@ extern l2cap_con *testcon3;
=20
void test_init(void);
void test_shutdown(void);
-s32 test_connect_req(BD_ADDR bd);
-s32 test_connect_psmreq(BD_ADDR bd, u16 psm);
+s32 test_connect_req(BD_ADDR bd, bt_pincode *pincode);
+s32 test_connect_psmreq(BD_ADDR bd, u16 psm, bt_pincode *pincode);
void test_connect_ind(l2cap_con *l2cap);
void test_connect_cfm(l2cap_con *l2cap, s32 status);
void test_connect_pnd(l2cap_con *l2cap, s32 status);
|
|
From: Anders J. <and...@us...> - 2003-11-05 15:22:25
|
The following files were modified in linux/drivers/char/bluetooth:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
bluetooth.c 1.239 1.240=20=20=20=20=20=20=20=20=20=20=20=20=20
bnep.c 1.18 1.19=20=20=20=20=20=20=20=20=20=20=20=20=20=20
hci.c 1.210 1.211=20=20=20=20=20=20=20=20=20=20=20=20=20
hci_sec.c 1.4 1.5=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
l2cap.c 1.137 1.138=20=20=20=20=20=20=20=20=20=20=20=20=20
l2cap_con.c 1.17 1.18=20=20=20=20=20=20=20=20=20=20=20=20=20=20
rfcomm.c 1.140 1.141=20=20=20=20=20=20=20=20=20=20=20=20=20
sdp.c 1.90 1.91=20=20=20=20=20=20=20=20=20=20=20=20=20=20
sec_client.c 1.27 1.28=20=20=20=20=20=20=20=20=20=20=20=20=20=20
tcs.c 1.18 1.19=20=20=20=20=20=20=20=20=20=20=20=20=20=20
test.c 1.40 1.41=20=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* Added pincode per connection, used when we are initiating a connection
as we can't communicate with btsec if we are waiting for connection=20
complete.
* Changed some ioctls.
* Corrected RFCOMM if we recive a DM the waitqueue wasn't released.
* Added block/nonblock option to some HCI commands.
The diff of the modified file(s):
--- bluetooth.c 2003/04/14 08:43:46 1.239
+++ bluetooth.c 2003/11/05 15:21:58 1.240
@@ -207,7 +207,7 @@ static void bt_receive_data(u8* data, u3
static void bt_show_version(void);
static s32 bt_init_stack(void);
static s32 bt_ctrl_init(void);
-static s32 bt_connect(u8 *bd_addr, u32 con_id);
+static s32 bt_connect(bt_connection *bt_con);
static s32 bt_disconnect(u32 con_id);
#if BT_DRIVER_DEBUG
static const u8* psmname(u16 psm);
@@ -619,7 +619,7 @@ __bt_ioctl(struct tty_struct *tty, struc
copy_from_user(&btcon, (s32*)arg, size);
=20
BT_DRIVER(__FUNCTION__ ": BTCONNECT\n");
- return bt_connect(btcon.bd, btcon.id);
+ return bt_connect(&btcon);
=20
case BTDISCONNECT:
{
@@ -846,7 +846,7 @@ hci_inq_exit0:
copy_from_user(param, (s32*)arg, size);
/* First part of param contains BD address, last part link key,
see Bluetooth specification for more info*/
- result =3D hci_link_key_request_reply(param, param + 6);
+ result =3D hci_link_key_request_reply(param, param + 6, 1);
put_user(result, (s32*)arg);
break;
}
@@ -858,7 +858,7 @@ hci_inq_exit0:
=20
BT_DRIVER(__FUNCTION__ ": HCILINKKEYNEGATIVEREPLY\n");
copy_from_user(bd_addr, (s32*)arg, size);
- result =3D hci_link_key_request_negative_reply(bd_addr);
+ result =3D hci_link_key_request_negative_reply(bd_addr, 1);
put_user(result, (s32*)arg);
break;
}
@@ -872,7 +872,7 @@ hci_inq_exit0:
copy_from_user(param, (s32*)arg, size);
/* First part of param contains BD address, second part of the
pin code, and the last part och the pin code length */
- result =3D hci_pin_code_request_reply(param, param + 6, *(param + 22));
+ result =3D hci_pin_code_request_reply(param, param + 6, *(param + 22), 1=
);
put_user(result, (s32*)arg);
break;
}
@@ -884,7 +884,7 @@ hci_inq_exit0:
=20
BT_DRIVER(__FUNCTION__ ": HCIPINCODENEGATIVEREPLY\n");
copy_from_user(bd_addr, (s32*)arg, size);
- result =3D hci_pin_code_request_negative_reply(bd_addr);
+ result =3D hci_pin_code_request_negative_reply(bd_addr, 1);
put_user(result, (s32*)arg);
break;
}
@@ -1542,10 +1542,13 @@ hci_inq_exit0:
s32 tmp;
u8 result[4];
=20
- copy_from_user(&bd_addr, (s32*)arg, size);
- BT_DRIVER("BNEP connection to %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
- bd_addr[0],bd_addr[1],bd_addr[2],bd_addr[3],bd_addr[4],bd_addr[5]);
- tmp =3D bnep_connect_req(bd_addr);
+ copy_from_user(&btcon, (s32*)arg, size);
+ BT_DRIVER("BNEP connection to %02x:%02x:%02x:%02x:%02x:%02x\n",
+ btcon.bd[0],btcon.bd[1],btcon.bd[2],btcon.bd[3],btcon.bd[4],btcon.bd[5]=
);
+ BT_DRIVER("Using src UUID 0x%04x and dst UUID 0x%04x\n", btcon.bnep_src_=
uuid,
+ btcon.bnep_dst_uuid);
+=09=09
+ tmp =3D bnep_connect_req(btcon.bd, &btcon.pincode);
=20
result[0] =3D (tmp>>8)&0x0ff; // conn hdl
result[1] =3D (tmp>>16)&0x0ff; // conn hdl
@@ -2286,10 +2289,14 @@ bt_receive_data(u8* data, u32 count)
*/
=20
s32
-bt_connect(u8 *bd_addr, u32 con_id)
+bt_connect(bt_connection *btcon)
{
- u8 line =3D GET_LINE(con_id);
+ u8 line;
s32 retval =3D 0;
+ u8 *bd_addr =3D btcon->bd;
+ u32 con_id =3D btcon->id;
+ line =3D GET_LINE(con_id);
+=09
=20
/* Check if we already got a connection on the line */
if ((SESSIONSTATE(line) =3D=3D BT_LOWERCONNECTED)||
@@ -2314,7 +2321,7 @@ bt_connect(u8 *bd_addr, u32 con_id)
srv_ch, line);
BT_DATADUMP("Remote BD: ", bd_addr, 6);
=20
- if ((retval =3D rfcomm_connect_req(bd_addr, srv_ch, line)) < 0) {
+ if ((retval =3D rfcomm_connect_req(bd_addr, srv_ch, line, &btcon->pincod=
e)) < 0) {
BT_DRIVER(__FUNCTION__ ": Failed\n");
return retval;
}
@@ -2339,7 +2346,7 @@ bt_connect(u8 *bd_addr, u32 con_id)
=20
BT_DRIVER(__FUNCTION__ ": Connecting SDP on line %d\n", line);
BT_DATADUMP("Remote BD: ", bd_addr, 6);
- if ((sdp_connection_id =3D sdp_connect_req(bd_addr, line)) >=3D 0) {
+ if ((sdp_connection_id =3D sdp_connect_req(bd_addr, line, &btcon->pincod=
e)) >=3D 0) {
=20
/*
* If here, we have successfully created an SDP
@@ -2396,7 +2403,7 @@ bt_connect(u8 *bd_addr, u32 con_id)
case L2CAP_TEST3_LAYER:
BT_DRIVER(__FUNCTION__ ": Connecting TEST_LAYER (psm %02X) on line %d\n"=
, GET_PSM(con_id), line);
=20
- if((retval =3D test_connect_psmreq(bd_addr, GET_PSM(con_id))) < 0) {
+ if((retval =3D test_connect_psmreq(bd_addr, GET_PSM(con_id), &btcon->pin=
code)) < 0) {
BT_DRIVER(__FUNCTION__ ": Failed\n");
return retval;
}
@@ -2404,7 +2411,7 @@ bt_connect(u8 *bd_addr, u32 con_id)
return retval;
=20
case TCS_LAYER:
- return tcs_connect_req(bd_addr);
+ return tcs_connect_req(bd_addr, &btcon->pincode);
=20
default:
BT_DRIVER(__FUNCTION__ ": PSM %d not supported as client\n",
@@ -2484,9 +2491,9 @@ bt_connect_cfm(u32 con_id, s32 status)
=20
switch (psm) {
case RFCOMM_LAYER:
- CHECK_RFCOMM(con_id);
bt_ctrl.session[line].connect_status =3D status;
-
+ if(status =3D=3D 0) {
+ CHECK_RFCOMM(con_id);
BT_DRIVER(__FUNCTION__ ": Line %d [%s]\n",
line, psmname(psm));
#ifdef CONFIG_BLUETOOTH_PROC
@@ -2495,7 +2502,9 @@ bt_connect_cfm(u32 con_id, s32 status)
new_con_connected =3D 1; // New connection
/* Wake up if someone reads the proc file */
wake_up_interruptible(&channel_con_wq);
+=09=09
#endif
+ }
release_wq_timer(&bt_ctrl.bt_timer[line]);
wake_up_interruptible(&bt_ctrl.connect_wq[line]);
wake_up_interruptible(&bt_ctrl.any_wq);
--- bnep.c 2003/06/05 11:32:28 1.18
+++ bnep.c 2003/11/05 15:21:58 1.19
@@ -1600,12 +1600,12 @@ bnep_setup_connection(struct net_local *
}
=20
u32
-bnep_connect_req(u8 *bd_addr)=20
+bnep_connect_req(u8 *bd_addr, bt_pincode *pincode)=20
{
DSYS("BNEP: Connect request %02x:%02x:%02x:%02x:%02x:%02x\n",
bd_addr[0],bd_addr[1],bd_addr[2],bd_addr[3],bd_addr[4],bd_addr[5]);
=20=09
- if (l2ca_connect_req(bd_addr, BNEP_LAYER)) {
+ if (l2ca_connect_req(bd_addr, BNEP_LAYER, pincode)) {
D_ERR(__FUNCTION__": l2ca_connect_req failed\n");
return -1;
}
--- hci.c 2003/04/14 08:43:46 1.210
+++ hci.c 2003/11/05 15:21:58 1.211
@@ -2295,7 +2295,7 @@ reject_connection_request(u8 bd[], u32 r
}
=20
s32
-hci_link_key_request_reply(u8 *bd, u8* link_key)
+hci_link_key_request_reply(u8 *bd, u8* link_key, u8 block)
{
u32 c =3D 0;
s32 tmp;
@@ -2312,7 +2312,11 @@ hci_link_key_request_reply(u8 *bd, u8* l
c +=3D 16;
c_pkt.len =3D c;
=20
+ if (block)
tmp =3D send_cmd_block((u8*) &c_pkt , c_pkt.len + CMD_HDR_LEN + HCI_HDR_L=
EN, DEFAULT_TIMEOUT);
+ else
+ tmp =3D send_cmd((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN);
+
if (tmp < 0) {
return tmp;
} else {
@@ -2322,7 +2326,7 @@ hci_link_key_request_reply(u8 *bd, u8* l
=20
=20
s32
-hci_link_key_request_negative_reply(u8 *bd)
+hci_link_key_request_negative_reply(u8 *bd, u8 block)
{
s32 tmp;
=20
@@ -2335,7 +2339,11 @@ hci_link_key_request_negative_reply(u8 *
=20
c_pkt.len =3D 6;
=20
+ if (block)
tmp =3D send_cmd_block((u8*) &c_pkt , c_pkt.len + CMD_HDR_LEN + HCI_HDR_L=
EN, DEFAULT_TIMEOUT);
+ else
+ tmp =3D send_cmd((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN);
+=09
printk(__FUNCTION__ ": Returned from send_secblock\n");
if (tmp < 0) {
return tmp;
@@ -2344,10 +2352,8 @@ hci_link_key_request_negative_reply(u8 *
}
}
=20
-
-/* fixme -- does this really need to be non blocking ? */
s32
-hci_pin_code_request_reply(u8 *bd, u8 *pin, u8 pin_len)
+hci_pin_code_request_reply(u8 *bd, u8 *pin, u8 pin_len, u8 block)
{
u32 c =3D 0;
s32 tmp;
@@ -2367,8 +2373,11 @@ hci_pin_code_request_reply(u8 *bd, u8 *p
c +=3D 16;
=20
c_pkt.len =3D c;
-
+ if (block)
tmp =3D send_cmd_block((u8*) &c_pkt , c_pkt.len + CMD_HDR_LEN + HCI_HDR_L=
EN, DEFAULT_TIMEOUT);
+ else
+ tmp =3D send_cmd((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN);
+
if (tmp < 0) {
return tmp;
} else {
@@ -2378,7 +2387,7 @@ hci_pin_code_request_reply(u8 *bd, u8 *p
=20
=20
s32
-hci_pin_code_request_negative_reply(u8 *bd)
+hci_pin_code_request_negative_reply(u8 *bd, u8 block)
{
s32 tmp;
=20
@@ -2391,7 +2400,11 @@ hci_pin_code_request_negative_reply(u8 *
=20
c_pkt.len =3D 6;
=20
+ if (block)
tmp =3D send_cmd_block((u8*) &c_pkt , c_pkt.len + CMD_HDR_LEN + HCI_HDR_L=
EN, DEFAULT_TIMEOUT);
+ else
+ tmp =3D send_cmd((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN);
+
if (tmp < 0) {
return tmp;
} else {
--- hci_sec.c 2002/08/01 16:19:28 1.4
+++ hci_sec.c 2003/11/05 15:21:59 1.5
@@ -106,7 +106,7 @@ hci_process_sec_man_response(u16 result,
D(printk("Ping length : %d\n", pin_length));
hci_pin_code_request_reply(remote_bd,
event_param,
- pin_length);
+ pin_length, 1);
=20=09=09=09
break;
case UNKNOWN_REQUEST_TYPE:
@@ -116,7 +116,7 @@ hci_process_sec_man_response(u16 result,
case ENCRYPTION_FAILURE:
case GENERAL_FAILURE:
default:
- hci_pin_code_request_negative_reply(remote_bd);
+ hci_pin_code_request_negative_reply(remote_bd, 1);
}
break;
=20=09=20=20=20=20
@@ -124,7 +124,7 @@ hci_process_sec_man_response(u16 result,
switch(result) {
case SECURITY_OK:
D(printk("Link key returned\n"));
- hci_link_key_request_reply(remote_bd, event_param);
+ hci_link_key_request_reply(remote_bd, event_param, 1);
break;
case UNKNOWN_REQUEST_TYPE:
case UNKNOWN_REQUEST_VALUE:
@@ -134,7 +134,7 @@ hci_process_sec_man_response(u16 result,
case GENERAL_FAILURE:
default:
D(printk("Link key not returned\n"));
- hci_link_key_request_negative_reply(remote_bd);
+ hci_link_key_request_negative_reply(remote_bd, 1);
}
default:
;
--- l2cap.c 2003/04/14 08:43:47 1.137
+++ l2cap.c 2003/11/05 15:21:59 1.138
@@ -283,9 +283,6 @@ l2cap_init(void)
l2cap_sec_man_init();
#endif
=20=20=20=20=20=20=20=20=20
-#if L2CAP_SELFTEST
- test_conlist();
-#endif
#ifdef CONFIG_BLUETOOTH_L2CAP_CONNECTIONLESS
l2cap->allow_conless =3D 1;
#else
@@ -1538,7 +1535,7 @@ process_frame(l2cap_con *con, u8 *data,=20
/*****************************/
=20
s32=20
-l2ca_connect_req(BD_ADDR bd, u16 psm)
+l2ca_connect_req(BD_ADDR bd, u16 psm, bt_pincode *pincode)
{
l2cap_con *con;
l2cap_con *tmpcon;
@@ -1609,6 +1606,11 @@ l2ca_connect_req(BD_ADDR bd, u16 psm)
PRINTSTATE(con);
} else {
D_STATE(__FUNCTION__ ": create new baseband link\n");
+ /* Pincode is set per baseband link */
+ if(pincode) {
+ memcpy(con->pincode.data, pincode->data, 0x10);
+ con->pincode.len =3D pincode->len;
+ }
retval =3D lp_connect_req(con->remote_bd);
if(retval < 0) {
D_ERR(__FUNCTION__ ": failed (status %d)\n", retval);
--- l2cap_con.c 2003/04/14 12:30:05 1.17
+++ l2cap_con.c 2003/11/05 15:21:59 1.18
@@ -169,6 +169,7 @@ create_con(u16 hci_hdl, CID lcid, CID rc
con->hci_hdl =3D hci_hdl;
con->local_cid =3D lcid;
con->remote_cid =3D rcid;=09
+ con->pincode.len =3D 0;
=20
con->next =3D con;
con->prev =3D con;
@@ -200,6 +201,7 @@ reset_con(l2cap_con* con)
con->timers.rtx.inuse =3D 0;
con->timers.ertx.inuse =3D 0;
con->timers.rtx_no =3D 0;
+ con->pincode.len =3D 0;
=20
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
con->wq =3D NULL;
@@ -310,6 +312,8 @@ check_remote_cid(u16 hdl, CID remote_cid
memcpy(new_con->remote_bd, found->remote_bd, 6);
memcpy(new_con->remote_class_of_dev, found->remote_class_of_dev, 3);
new_con->role =3D found->role;
+ memcpy(new_con->pincode.data, found->pincode.data, 0x10);
+ new_con->pincode.len =3D found->pincode.len;
=20=20=20=20=20=20=20=20=20=20=20=20=20
insert_con(new_con);
SHOW_LIST();
@@ -502,46 +506,6 @@ count_con(u16 hci_hdl)
D_CON(__FUNCTION__ ": %d l2cap_con's found with hci_hdl:%d\n",sum,hci_hdl=
);
return sum;
}
-
-#if L2CAP_SELFTEST
-s32=20
-remove_rcid(CID rcid) /* Searches for remote_cid */
-{
- D_CON("remove_rcid\n");
-=20=20
- if (!con_list.count) {
- D_CON(__FUNCTION__ ": no connections in list\n");
- return -1;
- }
- delete_con(get_rcon(rcid));
- D_CON("remote cid %d removed\n", rcid);
- return 0;
-}
-
-void=20
-test_conlist(void)
-{
- /* Fixme - make it better... */
-
- insert_con(create_con(0, 0, 0));
- show_list();
- insert_con(create_con(1, 1, 1));
- show_list();
- insert_con(create_con(2, 2, 2));
- insert_con(create_con(3, 3, 3));
- insert_con(create_con(4, 4, 4));
- insert_con(create_con(5, 5, 5));
- insert_con(create_con(6, 6, 6));
- show_list();
- remove_rcid(3);
- show_list();
- remove_rcid(5);
- show_list();
- free_con_list();
- show_list();
- /* ... */
-}
-#endif /* L2CAP_SELFTEST */
=20
void=20
show_con(const u8* head, l2cap_con* con)
--- rfcomm.c 2003/04/14 16:11:03 1.140
+++ rfcomm.c 2003/11/05 15:21:59 1.141
@@ -702,7 +702,7 @@ rfcomm_close(void)
/* This function creates an rfcomm connection over the control channel DCL=
I 0 */
=20
s32
-rfcomm_connect_req(u8* bd_addr, u8 server_chn, u8 line)
+rfcomm_connect_req(u8* bd_addr, u8 server_chn, u8 line, bt_pincode *pincod=
e)
{
rfcomm_con *rfcomm;
u8 tmp_dlci;
@@ -728,7 +728,7 @@ rfcomm_connect_req(u8* bd_addr, u8 serve
rfcomm->dlci[0].state =3D CONNECTING;
=20
/* we don't have a l2cap connection yet */
- if ((retval =3D l2ca_connect_req(bd_addr, RFCOMM_LAYER)) < 0) {
+ if ((retval =3D l2ca_connect_req(bd_addr, RFCOMM_LAYER, pincode)) < 0) {
D_ERR(FNC"l2ca_connect_req failed\n");
return retval;
}
@@ -1213,6 +1213,8 @@ rfcomm_receive_data(l2cap_con *l2cap, u8
D_CTRL(FNC"DM packet received\n");
rfcomm =3D ((rfcomm_con*) l2cap->upper_con);
rfcomm->dlci[tmp_dlci].state =3D DISCONNECTED;
+ /* wake up any blocking connect/waits */
+ bt_connect_cfm(CREATE_RFCOMM_ID(rfcomm->line, tmp_dlci), -MSGCODE(MSG_LA=
YER_RFCOMM, RFCOMM_CONNECT_FAILED));
=20
/* Notify upper tty */
/* bt_disconnect_ind() ? */
--- sdp.c 2003/04/14 16:11:05 1.90
+++ sdp.c 2003/11/05 15:21:59 1.91
@@ -467,7 +467,7 @@ sdp_remove_proc_file(void)
#endif /* __KERNEL__ */
=20
s32=20
-sdp_connect_req(u8* bd_addr, u8 line)
+sdp_connect_req(u8* bd_addr, u8 line, bt_pincode *pincode)
{
sdp_con *sdp;
=20=20=20
@@ -481,7 +481,7 @@ sdp_connect_req(u8* bd_addr, u8 line)
sdp->initiator =3D TRUE;
sdp->line =3D line;
=20=09
- if (l2ca_connect_req(bd_addr, SDP_LAYER)) {
+ if (l2ca_connect_req(bd_addr, SDP_LAYER, pincode)) {
D_ERR(__FUNCTION__ " ERROR l2ca_connect_req failed\n");
return -1;
}
--- sec_client.c 2003/05/22 14:51:11 1.27
+++ sec_client.c 2003/11/05 15:21:59 1.28
@@ -54,7 +54,9 @@
#include <linux/bluetooth/l2cap_sec.h>
#include <linux/bluetooth/rfcomm_sec.h>
#include <linux/bluetooth/hci_sec.h>
+#include <linux/bluetooth/hci_internal.h>
#include <linux/bluetooth/btmem.h>
+#include <linux/bluetooth/l2cap.h>
#include <linux/proc_fs.h>
#else /* user mode */
#include <stdlib.h>
@@ -151,9 +153,6 @@ struct proc_buffer {
u32 out;
} proc_buffer;
=20
-
-=09
-
/****************** LOCAL FUNCTION DECLARATION SECTION *******************=
***/
=20
#ifdef __KERNEL__
@@ -591,6 +590,32 @@ sec_man_event(enum security_requests use
}
else
{
+ /* If the connection is initiated by us we shall not try to=20
+ send the request to the sec manager as the waitqueue
+ for the connection request block read of the reply,
+ handle this case locally */
+ l2cap_con* con =3D get_con(bd_addr, ANY_STATE);
+ if(con && con->initiator)
+ {
+ switch(event) {
+ case PIN_CODE_REQUEST:
+ if(con->pincode.len)
+ hci_pin_code_request_reply(bd_addr,=20
+ con->pincode.data,=20
+ con->pincode.len, 0);
+ else
+ hci_pin_code_request_negative_reply(bd_addr, 0);
+ break;
+ case LINK_KEY_REQUEST:
+ hci_link_key_request_negative_reply(bd_addr, 0);
+ break;
+ default:
+ printk("Received event %d, no action\n", event);
+ }
+=09=09=09=09
+ return 0;
+ }
+=09=09
#ifndef __KERNEL__
if (sec_man_sock < 0) {
return -1;
--- tcs.c 2003/04/14 08:43:50 1.18
+++ tcs.c 2003/11/05 15:21:59 1.19
@@ -258,9 +258,9 @@ tcs_shutdown(void)
}
=20
s32
-tcs_connect_req(u8 *bd)
+tcs_connect_req(u8 *bd, bt_pincode *pincode)
{
- if (l2ca_connect_req(bd, TCS_LAYER)) {
+ if (l2ca_connect_req(bd, TCS_LAYER, pincode)) {
D_ERR(" tcs_connect_req: l2ca_connect_req failed\n");
return -1;=20
}
--- test.c 2003/04/14 08:43:50 1.40
+++ test.c 2003/11/05 15:21:59 1.41
@@ -188,22 +188,22 @@ void test_shutdown(void)
}
=20
s32
-test_connect_req(BD_ADDR bd)
+test_connect_req(BD_ADDR bd, bt_pincode *pincode)
{
s32 retval =3D 0;
D_STATE("test_connect_req to psm 0x%x\n", L2CAP_TEST_LAYER);
=20
- if ((retval =3D l2ca_connect_req(bd, L2CAP_TEST_LAYER)) < 0) {
+ if ((retval =3D l2ca_connect_req(bd, L2CAP_TEST_LAYER, pincode)) < 0) {
D_ERR(" tcs_connect_req: l2ca_connect_req failed\n");
}
return retval;
}
=20
s32
-test_connect_psmreq(BD_ADDR bd, u16 psm)
+test_connect_psmreq(BD_ADDR bd, u16 psm, bt_pincode *pincode)
{
D_STATE("test_connect_req on psm 0x%x\n", psm);
- return l2ca_connect_req(bd, psm);
+ return l2ca_connect_req(bd, psm, pincode);
}
=20
static void
@@ -546,7 +546,7 @@ test_process_cmd(unsigned char *cmd, s32
printk("bb_conn read [%d] =3D 0x%x\n", i, bd[i]);
p++;
}
- return l2ca_connect_req(bd, fake_psm);
+ return l2ca_connect_req(bd, fake_psm, NULL);
}
else if(!strncmp(cmd, "tx_data ", 8)) {
int lcid, len;
|
|
From: Anders J. <and...@us...> - 2003-11-04 15:24:31
|
The following files were modified in libs/openbt:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
bt_if.c 1.1 1.2=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
bt_if.h 1.1 1.2=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* Changed bt_inquiry call to return a list of found devices.
* Changed bt_read_remote_name to use HCIREMOTENAME_REQUEST.
* All output from inquiry shall be done from the calling application.
The diff of the modified file(s):
--- bt_if.c 2003/11/04 10:59:39 1.1
+++ bt_if.c 2003/11/04 15:24:30 1.2
@@ -393,7 +393,6 @@ void bt_showstatus(void)
#endif
}
=20
-/* fixme<1> -- add usermode stack version */
int
bt_send(int fd, int len, int repeat)
{
@@ -989,8 +988,8 @@ bt_write_page_scan_activity(int bt_cfd,=20
#endif
}
=20
-int
-bt_inquiry(int bt_cfd, int nbr_rsp, int t, int get_name)
+inquiry_results *
+bt_inquiry(int bt_cfd, int nbr_rsp, int t)
{
int retval =3D 0;
#ifdef BTD_USERSTACK
@@ -1004,13 +1003,12 @@ bt_inquiry(int bt_cfd, int nbr_rsp, int=20
=20
retval =3D hci_inquiry(inq_lap, t, nbr_rsp);
#else
- int i;
inquiry_results *inq_res;
=20
if (!(inq_res =3D malloc(sizeof *inq_res + nbr_rsp * 6)))
{
- fprintf(stderr, "%s: Failed to allocate result structure!\n", __FUNCTI=
ON__);
- return -ENOMEM;
+ fprintf(stderr, "Inquiry failed: %s\n", strerror(errno));
+ return NULL;
}
=20
inq_res->nbr_of_units =3D nbr_rsp;
@@ -1020,75 +1018,12 @@ bt_inquiry(int bt_cfd, int nbr_rsp, int=20
{
fprintf(stderr, "Inquiry failed [%s (%d)]\n", error_msg(retval), MSG_G=
ET_CODE(-retval));
free(inq_res);
- return retval;
- }
-
- if (get_name)
- {
- unsigned char name_device[255];
- /* First print the number of units found */
- printf("%d", inq_res->nbr_of_units);
-
- for (i =3D 0; i < inq_res->nbr_of_units; i++)
- {
- /* Copy BD_ADDR to send in ioctl */
- memcpy(name_device,inq_res->bd_addr + 6*i, 6);
-
- if ((retval =3D ioctl(bt_cfd, HCIREMOTENAME_REQUEST, name_device)) <=
0)
- {
- fprintf (stderr, "Remote name request failed [%s (%d)]\n", error_m=
sg(retval), MSG_GET_CODE(-retval));
- /* Test if the problem is that the IOCTL doesn't exist */
- if (errno =3D=3D EINVAL)
- fprintf(stderr, "btinq: error: the ioctl HCIREMOTENAME_REQUEST d=
oesn't exist in the driver");
- /* Print a default name */
- printf("\nDevice with unknown name");
- }
- else
- {
- switch (retval)
- {
- case 0x04: /* Page timeout */
- printf("\nDevice with unknown name");
- break;
-
- case 0x00:
- if (name_device[0] =3D=3D '\0')
- {
- printf("Device with empty name\n");
- }
- else
- {
- printf("\n%s", name_device);
- }
- break;
-
- default:
- printf("\nDevice with unrecoverable name");
- break;
- } /* Switch */
+ return NULL;
}
=20
- /* Print BD address */
- printf("\n%02x:%02x:%02x:%02x:%02x:%02x",
- inq_res->bd_addr[0+6*i], inq_res->bd_addr[1+6*i],
- inq_res->bd_addr[2+6*i], inq_res->bd_addr[3+6*i],
- inq_res->bd_addr[4+6*i], inq_res->bd_addr[5+6*i]);
- } /* End of loop on every addresses founded */
- } /* End of if get_name */
- else
- {
- /* Just write addresses as it was historically done */
- for (i =3D 0; i < inq_res->nbr_of_units; i++)
- {
- printf("BD %d: %02x:%02x:%02x:%02x:%02x:%02x\n",i,
- inq_res->bd_addr[0+6*i], inq_res->bd_addr[1+6*i],
- inq_res->bd_addr[2+6*i], inq_res->bd_addr[3+6*i],
- inq_res->bd_addr[4+6*i], inq_res->bd_addr[5+6*i]);
- }
- }
- free(inq_res);
+ return inq_res;
#endif
- return retval;
+ return inq_res;
}
=20
void
@@ -1235,18 +1170,25 @@ read_remote_bd(int bt_cfd, int line, uns
}
=20
int
-read_remote_name(int bt_cfd, int line, unsigned char *name, unsigned int l=
ength)
+read_remote_name(int bt_cfd, unsigned char *buf, unsigned int length)
{
-#ifndef BT_USERSTACK
- *(int*)name =3D line;
- *((int*)name+1) =3D length;
+ unsigned char tmpbuf[255];
+ int cpylen =3D length - 1;
+ memcpy(tmpbuf, buf, 6);
+ if(cpylen > 254)
+ {
+ cpylen =3D 254;
+ }
=20
- if (ioctl(bt_cfd, BTREADREMOTENAME, name) < 0)
+#ifndef BT_USERSTACK
+ if (ioctl(bt_cfd, HCIREMOTENAME_REQUEST, tmpbuf) < 0)
{
perror(__FUNCTION__);
return -1;
}
=20
+ memcpy(buf, tmpbuf, cpylen);
+ buf[cpylen] =3D 0;
return 0;
#else
fprintf(stderr, __FUNCTION__ ": Not yet implemented...\n");
--- bt_if.h 2003/11/04 10:59:39 1.1
+++ bt_if.h 2003/11/04 15:24:30 1.2
@@ -356,13 +356,13 @@ int bt_ping(int bt_cfd, unsigned char bd
int bt_getinfo(int bt_cfd, unsigned char bd[6], unsigned short type);
int bt_testcmd(int bt_cfd, unsigned char *cmd);
=20
-int bt_inquiry(int bt_cfd, int nbr_rsp, int t, int get_name);
+inquiry_results *bt_inquiry(int bt_cfd, int nbr_rsp, int t);
int bt_set_baudrate(int bt_cfd, const char *speedstr);
void bt_set_bd_addr(int bt_cfd, unsigned char *bd);
void read_local_bd(int bt_cfd, unsigned char *bd_addr);
void read_remote_bd(int bt_cfd, int line, unsigned char *bd_addr);
void read_remote_class(int bt_cfd, unsigned char *bd_addr, unsigned char *=
remote_class);
-int read_remote_name(int bt_cfd, int line, unsigned char *name, unsigned i=
nt length);
+int read_remote_name(int bt_cfd, unsigned char *buf, unsigned int length);
void role_switch(int bt_cfd, unsigned char *bd_addr, int role);
=20
int bt_set_event_filter(int bt_cfd, unsigned char *filter, int len);
|