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: Mattias A. <mat...@us...> - 2001-04-25 17:39:14
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.171 1.172=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * added check when unregistering tty in bt_close. The closing pid must be same as the one that opened tty. * don't sleep in bt_connect/bt_disconnect if request failed (releases=20 blocks immediately) * added error code when trying to disconnect in not connected state. * changed some debug The diff of the modified file(s): --- bluetooth.c 2001/04/20 14:33:07 1.171 +++ bluetooth.c 2001/04/25 17:39:13 1.172 @@ -81,6 +81,7 @@ #include <linux/bluetooth/tcs.h> #include <linux/bluetooth/sdp.h> #include <linux/bluetooth/sec_client.h> +#include <linux/bluetooth/bt_errno.h> =20 #ifdef CONFIG_BLUETOOTH_USE_TCI #include <linux/bluetooth/tci.h> @@ -459,23 +460,24 @@ bt_chars_in_buffer(struct tty_struct *tty) { u16 n =3D buf_byte_count(); + /* what if multiple pppd are running and one pppd=20 + ends, then this won't be zero.... */ + + /* fixme -- we must find number bytes belonging to=20 + this line */ =20 BT_DRIVER("bt_chars_in_buffer : %d\n", n);=20=20 return n; } =20 -/* Must flush the buffer, otherwise chars_in_buffer returns nonzero - and pppd hangs on the exit while doing the set line disc ioctl */ static void bt_flush_buffer(struct tty_struct *tty) { /* Clearing the buffers here may lead to them being cleared before they are sent when diconnecting a connection */ + BT_DRIVER("bt_flush_buffer, ignored\n"); #if 0 bt_tx_buf* tx_buf; - - BT_DRIVER("bt_flush_buffer\n"); -=09 while ((tx_buf =3D get_bt_buf())) { unsubscribe_bt_buf(tx_buf); } @@ -1077,6 +1079,7 @@ =20=09=09 BT_DRIVER("BTSETMSSWITCH : %d\n", enable); hci_force_msswitch(enable); + return 0; } =20=09=09 default:=09=09 @@ -1661,12 +1664,18 @@ BT_DRIVER(FNC"Connecting srv ch %d on line %d\n", srv_ch, line); BT_DATADUMP("Remote BD : ", bd_addr, 6); - rfcomm_connect_req(bd_addr, srv_ch, line);=09=09 =20 + if (rfcomm_connect_req(bd_addr, srv_ch, line) < 0){ + BT_DRIVER("bt_connect failed\n"); + return bt_ctrl.session[line].connect_status; + } +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 + /* sleep if not yet connected */ + if (bt_ctrl.session[line].connect_status =3D=3D -1) { start_wq_timer(&bt_timer, BT_CON_TIMEOUT,=20 &bt_ctrl.connect_wq[line]); - interruptible_sleep_on(&bt_ctrl.connect_wq[line]); + } return bt_ctrl.session[line].connect_status; } break; @@ -1913,15 +1922,28 @@ =20 bt_ctrl.session[line].disconnect_status =3D -1; =20 - start_wq_timer(&bt_timer, BT_CON_TIMEOUT, &bt_ctrl.connect_wq[line]); + /* check if we have a connection */ + if ((SESSIONSTATE(line) =3D=3D BT_LOWERCONNECTED) ||=20 + (SESSIONSTATE(line) =3D=3D BT_ACTIVE)) + {=20=20=20=20=20=20=20=20=20=20 + if (rfcomm_disconnect_req(GET_RFCOMMLINE(con_id)) < 0) { + BT_DRIVER("bt_disconnect failed\n"); + return bt_ctrl.session[line].disconnect_status; + } =20 - rfcomm_disconnect_req(GET_RFCOMMLINE(con_id)); + /* fixme -- remove timers, useless when rfcomm blocks ? */ =20 - /* Only sleep if no reply yet, use connect wq for=20 - disconnect aswell */ + /* Sleep if not yet disconnected */ if (bt_ctrl.session[line].disconnect_status =3D=3D -1) { + /* use connect wq for dusconnect aswell */ + start_wq_timer(&bt_timer, BT_CON_TIMEOUT,=20 + &bt_ctrl.connect_wq[line]); interruptible_sleep_on(&bt_ctrl.connect_wq[line]); } + } + else + bt_ctrl.session[line].disconnect_status =3D MSGCODE(MSG_BT_INTERFACE,= =20 + BT_NOTCONNECTE= D); =20=09 return bt_ctrl.session[line].disconnect_status; } @@ -2380,6 +2402,7 @@ { /* don't touch con/disc status here */ bt_ctrl.session[line].upper_tty =3D NULL; + bt_ctrl.session[line].pid =3D 0; bt_ctrl.session[line].rfcomm =3D NULL; bt_ctrl.session[line].dlci =3D 0;=20 bt_ctrl.session[line].state =3D BT_INACTIVE; @@ -2553,7 +2576,7 @@ { s32 line =3D GET_TTYLINE(tty); =20=20 - DSYS("Registering tty on line %d\n", line); + BT_DRIVER("Registering tty on line %d\n", line); =20=09 /* Allow multiple open for ttyBTC */ if (line =3D=3D BT_NBR_PORTS-BT_NBR_CTRLPORTS) { @@ -2575,6 +2598,7 @@ (SESSIONSTATE(line) =3D=3D BT_INACTIVE)) { NBR_UPPER++; bt_ctrl.session[line].upper_tty =3D tty; + bt_ctrl.session[line].pid =3D current->pid; tty->driver_data =3D &bt_ctrl.session[line]; =20 if (SESSIONSTATE(line) =3D=3D BT_INACTIVE) @@ -2597,11 +2621,18 @@ s32 bt_unregister_tty(struct tty_struct *tty, s32 line) { - DSYS("Unregistering tty on line %d\n", line); + BT_DRIVER("Unregistering tty on line %d\n", line); =20 if (line =3D=3D BT_NBR_PORTS-BT_NBR_CTRLPORTS) { if (--NBR_CTRL_FDS !=3D 0) return 0; /* still more open fd:s on ttyBTC */ + } + + /* Check that the pid closing is the one that opened the tty */ + if (current->pid !=3D bt_ctrl.session[line].pid) + { + BT_DRIVER(__FUNCTION__" invalid pid\n"); + return -1; } =20 /* Check that it is ok to close this line ...=20 |
From: Mattias A. <mat...@us...> - 2001-04-25 17:12:49
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- l2cap.c 1.105 1.106=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: added missing declaration The diff of the modified file(s): --- l2cap.c 2001/04/25 16:58:24 1.105 +++ l2cap.c 2001/04/25 17:12:48 1.106 @@ -1335,6 +1335,7 @@ { l2cap_con *con; u8 rev_bd[6]; + s32 i; =20=09 D_STATE(__FUNCTION__ ": %s (hci_handle : %d)\n",=20 get_err_msg(status), con_hdl); |
From: Mattias A. <mat...@us...> - 2001-04-25 17:08:54
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- rfcomm.c 1.106 1.107=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: fixed typo... The diff of the modified file(s): --- rfcomm.c 2001/04/25 17:01:22 1.106 +++ rfcomm.c 2001/04/25 17:08:53 1.107 @@ -808,7 +808,8 @@ if (rfcomm->dlci[0].state !=3D DISCONNECTED) { printk("Rfcomm disconnect failed, reset session\n"); -#ifdef __KERNEL__ bt_unregister_rfcomm(rfcomm->line); +#ifdef __KERNEL__=09=09=09 + bt_unregister_rfcomm(rfcomm->line); bt_disconnect_cfm(CREATE_RFCOMM_ID(rfcomm->line, 0),=20 rfcomm->l2cap->c_result); #endif |
From: Mattias A. <mat...@us...> - 2001-04-25 17:01:23
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- rfcomm.c 1.105 1.106=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * added return codes in rfcomm_connect_req / rfcomm_disconnect_req The diff of the modified file(s): --- rfcomm.c 2001/04/18 15:47:13 1.105 +++ rfcomm.c 2001/04/25 17:01:22 1.106 @@ -703,7 +703,7 @@ =20 /* This function creates an rfcomm connection over the control channel DCL= I 0 */ =20=20=20 -u32=20 +s32=20 rfcomm_connect_req(u8* bd_addr, u8 server_chn, u8 line) { #define FNC "rfcomm_connect_req: " @@ -733,7 +733,7 @@ /* we don't have a l2cap connection yet */ if (l2ca_connect_req(bd_addr, RFCOMM_LAYER)) { D_ERR(FNC"l2ca_connect_req failed\n"); - return 0; + return -1; } } else if (!((rfcomm->l2cap)->current_state =3D=3D OPEN)) { =20 @@ -771,7 +771,7 @@ #undef FNC } =20 -void=20 +s32 rfcomm_disconnect_req(u8 line) { rfcomm_con *rfcomm; @@ -801,7 +801,6 @@ disconnect 'acknowledge' */ =20 interruptible_sleep_on(&rfcomm_disconnect_wq); - /* Check that rfcomm session really disconnected */ /* FIXME -- add timer obj with status in rfcomm obj */ =20 @@ -809,8 +808,7 @@ if (rfcomm->dlci[0].state !=3D DISCONNECTED) { printk("Rfcomm disconnect failed, reset session\n"); -#ifdef __KERNEL__ - bt_unregister_rfcomm(rfcomm->line); +#ifdef __KERNEL__ bt_unregister_rfcomm(rfcomm->line); bt_disconnect_cfm(CREATE_RFCOMM_ID(rfcomm->line, 0),=20 rfcomm->l2cap->c_result); #endif @@ -818,13 +816,12 @@ } =20 /* Now rfcomm is disconnected, disconnect l2cap */ - - l2ca_disconnect_req(l2cap); - - /* Now l2cap ch for RFCOMM is disconnected */ + return l2ca_disconnect_req(l2cap); } else D_WARN("rfcomm_disconnect_req : line not connected !\n"); + + return 0; } =20=09 =20 |
From: Mattias A. <mat...@us...> - 2001-04-25 16:58:25
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- l2cap.c 1.104 1.105=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * add deletion of failed l2cap con in lp_connect_cfm if non-initiator * added ifdefs around disable_rtx * l2ca_disconnect_req is now responsible of deleting disconnected l2cap=20 cons and shutting down baseband if nbr of l2cap cons are 0 on this handle. (Used to be done in l2ca_connect_cfm) * don't increment ID if retransmission * cleanup & minor changes The diff of the modified file(s): --- l2cap.c 2001/04/20 17:52:08 1.104 +++ l2cap.c 2001/04/25 16:58:24 1.105 @@ -292,7 +292,7 @@ if ((l2cap->my_bd[0] =3D=3D 0) && (l2cap->my_bd[1] =3D=3D 0) &&=20 (l2cap->my_bd[2] =3D=3D 0) && (l2cap->my_bd[3] =3D=3D 0) && (l2cap->my_bd[4] =3D=3D 0) && (l2cap->my_bd[5] =3D=3D 0)) - D_ERR("Failed to get local BD addr\n"); + D_ERR(__FUNCTION__ ": Failed to get local BD addr\n"); else { i =3D l2cap_sprint_bd(bd_name, l2cap->my_bd); bd_name[i] =3D 0; @@ -344,11 +344,11 @@ { DSYS("Shutting down L2CAP\n"); if (!l2cap->initiated) { - D_ERR("L2CAP not initiated\n"); + D_ERR(__FUNCTION__ ": L2CAP not initiated\n"); return -1; } =20 -/* experimental */ + /* fixme -- experimental */ #if 0 { l2cap_con *con; @@ -727,7 +727,7 @@ confreq->dst_cid, confreq->flags); =20=09=09 if ((con =3D get_lcon(confreq->dst_cid)) =3D=3D NULL) { - D_ERR("Couldn't find local CID\n"); + D_ERR(__FUNCTION__ ": Couldn't find local CID\n"); /* send back response ? */ l2cap_cmdrej(hci_handle, CMDREJ_INVALIDCID, NULL, 0); return; @@ -758,7 +758,7 @@ /* send back negative response */ if (l2ca_config_rsp(con, result, STAT_NOINFO,=20 CONF_FAILURE) < 0) { - D_ERR("Couldn't send conf rsp\n"); + D_ERR(__FUNCTION__ ": Couldn't send conf rsp\n"); } return; } @@ -777,7 +777,7 @@ convenient point=20 */ =20=09=09=09 - D_STATE("Got conf req in OPEN, renegotiate !\n"); + D_STATE(__FUNCTION__ "Got conf req in OPEN, renegotiate !\n"); =20 ENTERSTATE(con, CONFIG); PRINTSTATE(con); @@ -786,7 +786,7 @@ result =3D parse_options(con, confreq->options, req->len-4); } else { - D_ERR("Remote peer tried to renegotiate but cinf req contained no opti= ons !\n"); + D_ERR(__FUNCTION__": Remote peer tried to renegotiate but cinf req con= tained no options !\n"); return; } =20=09=09=09 @@ -801,7 +801,7 @@ if (l2ca_config_rsp(con, result,=20 STAT_NOINFO,=20 CONF_FAILURE) < 0) { - D_ERR("Couldnt send conf rsp\n"); + D_ERR(__FUNCTION__": Couldnt send conf rsp\n"); } return; } @@ -819,7 +819,7 @@ } =20=20=20=20=20=20=20=20=20=20=20=20 default: - D_ERR("Got config req in invalid state! [%s]\n", + D_ERR(__FUNCTION__": Got config req in invalid state! [%s]\n", state_name[con->current_state]); PRINTSTATE(con); break; @@ -885,7 +885,7 @@ break; =20 default: - D_ERR("Unknown info request: type 0x%x\n", info->type); + D_ERR(__FUNCTION__ ": Unknown info request: type 0x%x\n", info->type); l2cap_cmdrej(hci_handle, CMDREJ_NOTUNDERSTOOD, NULL, 0); break;=09=09 @@ -1003,7 +1003,11 @@ case RES_SUCCESS: =20 con->c_result =3D RES_SUCCESS; - l2ca_wakeup("l2cap connect rsp", con); + l2ca_wakeup("l2cap con rsp", con); + +#ifdef CONFIG_BLUETOOTH_L2CAP_USE_TIMERS + disable_rtx(con); +#endif ENTERSTATE(con, CONFIG); PRINTSTATE(con); l2ca_connect_cfm(con, conrsp->result); @@ -1094,7 +1098,7 @@ =20 if (!con->conf_rsp_ready) { /* Upper layers still haven't replied pos */ - D_STATE("Still haven't replied pos on other sides conf req\n"); + D_STATE(__FUNCTION__": Still haven't replied pos on other sides conf r= eq\n"); return ; } else {=09=09=09=09 ENTERSTATE(con, OPEN); @@ -1107,7 +1111,7 @@ opened a connection ! */ l2ca_config_cfm(con, confrsp->result); =20 - /* reset */ + /* reset variable */ con->conf_req_sent =3D 0; return; } @@ -1182,7 +1186,7 @@ #endif con->c_result =3D RES_SUCCESS; l2ca_disconnect_cfm(con); - l2ca_wakeup("l2cap_disconnect_rsp", con); + l2ca_wakeup("l2cap disc rsp", con); break; =20=20=20=20=20=20=20=20 case SIG_ECHORSP: { @@ -1191,7 +1195,7 @@ D_STATE(__FUNCTION__ ": Got echo response\n");=09=09 =20 if ((tempcon =3D get_con_hcihdl(hci_handle))=3D=3DNULL) { - D_STATE("Echo rsp: could not find connection\n"); + D_STATE(__FUNCTION__": Echo rsp, could not find connection\n"); return; } =20=09=09 @@ -1218,7 +1222,7 @@ l2cap_con *tempcon; =20 if ((tempcon =3D get_con_hcihdl(hci_handle))=3D=3DNULL) { - D_STATE("Echo rsp: could not find connection\n"); + D_STATE(__FUNCTION__": Echo rsp, could not find connection\n"); return; } =20 @@ -1330,11 +1334,18 @@ lp_connect_cfm(u8 *bd_addr, u32 status, u16 con_hdl) { l2cap_con *con; + u8 rev_bd[6]; +=09 D_STATE(__FUNCTION__ ": %s (hci_handle : %d)\n",=20 get_err_msg(status), con_hdl); =20 - D_STATE(__FUNCTION__ ": bd %s\n", bd2str(bd_addr)); + /* reverse byte order */ + for (i =3D 0; i < 6; i++) { + rev_bd[5-i] =3D bd_addr[i]; + } =20 + D_STATE(__FUNCTION__ ": bd %s\n", bd2str(rev_bd)); + /* FIXME -- use bt session list to notify upper layers that=20 con failed !!! */ =20 @@ -1355,7 +1366,7 @@ l2ca_wakeup("lp_connect_cfm (pos)", con); =20=09=09 if (con->c_flags & FLAG_RETURNNOW) { - printk("Return NOW\n"); + D_STATE(__FUNCTION__" Return NOW\n"); /* clear flag & set status */ con->c_flags &=3D ~FLAG_RETURNNOW; return; @@ -1389,10 +1400,15 @@ return; } =20 + if (con->initiator) { /* only notify upper layers if we are initiator */ - if (con->initiator) l2ca_connect_cfm(con, MSGCODE(MSG_LAYER_HCI,=20 status)); + } else { + /* delete connection if non-initiator */ + delete_con(con); + }=20 +=09=09 } } =20=20 @@ -1444,7 +1460,6 @@ =20 /* flush old buffers waiting to be sent on this handle */ btmem_flushhandle((u16)con_hdl); - //btmem_reset(); =20 #ifdef __CRIS__ if (bt_connections > 0) @@ -1590,7 +1605,6 @@ l2cap_connect_req(con, con->psm); =20 /* wait until we received a response or after timeout */ - l2ca_wait(__FUNCTION__ ": wait rsp", con); } =20 @@ -1614,7 +1628,9 @@ =20 if (con->current_state =3D=3D CONFIG) {=20=20 /* local mtu is set in l2cap_config_req */ +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 con->conf_req_sent =3D 1; + return l2cap_config_req(con, in_mtu, outflow,=20 flush_timeout, link_to);=20=20 =20 @@ -1622,7 +1638,7 @@ l2ca_config_cfm(con, CONF_REJ); return -1; } else if (con->current_state =3D=3D OPEN) { - printk("l2ca_config_req: state OPEN, reconfiguration !\n"); + DSYS("l2ca_config_req: state OPEN, reconfiguration !\n"); =20 /* FIXME -=20 Is data automatically suspended while reconfiguring ? @@ -1649,6 +1665,7 @@ l2ca_disconnect_req(l2cap_con *con) { s32 result =3D -1; + u16 tmp_hdl =3D con->hci_hdl; =20 if (PARANOIA_CHECKCON(con)) { D_ERR(__FUNCTION__ ": Paranoia check failed\n"); @@ -1672,10 +1689,30 @@ /* wait here until we get a confirm */ l2ca_wait(__FUNCTION__, con); =20 - return con->c_result; + result =3D con->c_result; + + if (con->current_state =3D=3D CLOSED) {=09 + /* remove l2cap connection */ + delete_con(con); + } else { + D_ERR("L2CAP Disconnect failed\n"); + PRINTSTATE(con); } =20 + /* fixme -- if we want to keep baseband connection we must=20 + leave the l2cap connection which holds the hci handle=20 + simply just clear l2cap params but keep hci handle ! */ =20 + if (count_con(tmp_hdl) =3D=3D 0) { + DSYS("l2ca_disconnect_req : (C) no more l2cap cons\n"); + DSYS("Shutdown baseband\n"); + lp_disconnect(tmp_hdl); + } + + return result; +} + + /* Response from upper layer to the indication of a channel to a remote=20 device */ s32=20 @@ -1750,7 +1787,7 @@ con->local_cid, con->remote_cid,=20 psm2str(con->psm)); =20 - /* reset */ + /* reset variable */ con->conf_req_sent =3D 0; =20 /* notify upper layers that we are opened */ @@ -1802,8 +1839,6 @@ if (count_con(con->hci_hdl) > 1) { delete_con(con);=20=20=20=20=20 } - /* If this con is the last with this hci_hdl, it is deleted=20 - when the baseband link goes down */ } else { D_ERR(__FUNCTION__ ": invalid state !\n\n"); PRINTSTATE(con); @@ -1819,7 +1854,7 @@ =20 void l2ca_timeoutind(l2cap_con *con) { - printk("l2ca_timeoutind\n"); + DSYS("l2ca_timeoutind\n"); con->c_status =3D CSTATUS_RTX_TIMEOUT;=09 l2ca_wakeup("l2ca_timeoutind ", con); } @@ -1981,7 +2016,12 @@ req->src_cid =3D cpu_to_le16(con->local_cid); =20=20=20 cmd->code =3D SIG_CONREQ; + + /* Don't increment ID if retransmission */ + if (con->timer.rtx_no =3D=3D 0) cmd->id =3D set_id(con); /* Sets sig_id_sent in l2cap_con */ + else + DSYS("RTX, use same ID\n"); =20 cmd->len =3D cpu_to_le16(CON_REQSIZE); =20 @@ -2062,7 +2102,7 @@ SIGCMD_HDRSIZE + CONF_REQSIZE); =20=20 if (in_mtu !=3D 0) { - printk("Sending in_mtu %d\n", in_mtu); + DSYS("Sending in_mtu %d\n", in_mtu); opt->type =3D OPT_MTU; opt->len =3D 2; *(opt->option_data) =3D (u8)(in_mtu & 0x00ff); @@ -2073,7 +2113,7 @@ } =20=09=09 if (flush_timeout !=3D 0) { - printk("Sending flush_timeout %d\n", flush_timeout); + DSYS("Sending flush_timeout %d\n", flush_timeout); opt->type =3D OPT_FLUSH; opt->len =3D 2; *(opt->option_data) =3D (u8)(flush_timeout & 0x00ff); @@ -2084,7 +2124,7 @@ } =20=09=09 if (outflow !=3D NULL) {=20 - printk("Sending conf req outflow\n"); + DSYS("Sending conf req outflow\n"); print_flow(outflow); opt->type =3D OPT_QOS; opt->len =3D sizeof *outflow; @@ -2098,7 +2138,15 @@ =20 /* Signalling header */ cmd->code =3D SIG_CONFREQ; + + /* Don't increment ID if retransmission */ + if (con->timer.rtx_no =3D=3D 0) cmd->id =3D set_id(con); /* Sets sig_id_sent in l2cap_con */ + else + DSYS("RTX, use same ID\n"); + + /* fixme -- wrong len field should be 2 more */ + cmd->len =3D cpu_to_le16(CONF_REQSIZE + opt_len); =20 SET_L2CAP_HDR(l2cap_buf->frame, payload_len, CIDSIG); @@ -2149,7 +2197,13 @@ req->src_cid =3D cpu_to_le16(con->local_cid); =20 cmd->code =3D SIG_DISCREQ; +=20=20=20=20=20=20=20=20 + /* Don't increment ID if retransmission */ + if (con->timer.rtx_no =3D=3D 0) cmd->id =3D set_id(con); /* Sets sig_id_sent in l2cap_con */ + else + DSYS("RTX, use same ID\n"); +=20=20=20=20=20=20=20=20 cmd->len =3D cpu_to_le16(DISC_REQSIZE); =20 SET_L2CAP_HDR(l2cap_buf->frame, payload_len, CIDSIG); @@ -2498,7 +2552,7 @@ opt =3D (struct l2cap_option*)(rsp + CONF_RSPSIZE); =20 if (out_mtu !=3D 0) { - printk("Sending out_mtu %d\n", out_mtu); + DSYS("Sending out_mtu %d\n", out_mtu); opt->type =3D OPT_MTU; opt->len =3D 2; *(opt->option_data) =3D (u8)(out_mtu & 0x00ff); @@ -2509,7 +2563,7 @@ } =20=09=09 if (in_flow !=3D NULL) {=20 - printk("Sending conf req in_flow\n"); + DSYS("Sending conf req in_flow\n"); print_flow(in_flow); opt->type =3D OPT_QOS; opt->len =3D sizeof *in_flow; @@ -2600,8 +2654,7 @@ if (tx->cur_len > con->remote_mtu) { D_ERR("%s tries to send more than remote mtu, ignore\n",=20 psm2str(con->psm)); - - D_ERR("SETTING FLUSHED ON THIS BUFFER !!!\n"); + D_ERR(__FUNCTION__ ": Flushing this buffer\n"); tx->flushed =3D 1; return -1; } @@ -2609,7 +2662,7 @@ /* Only send on an OPEN channel */ if (con->current_state !=3D OPEN) { D_ERR(__FUNCTION__ ": not in open state\n"); - D_ERR("SETTING FLUSHED ON THIS BUFFER !!!\n"); + D_ERR(__FUNCTION__ ": Flushing this buffer\n"); tx->flushed =3D 1; return -1; } @@ -2657,7 +2710,7 @@ con->remote_cid, status); =20=09 if (!con->initiator) {=20 - D_ERR(__FUNCTION__": server is not initiator !!!\n");=20 + D_ERR(__FUNCTION__": server is not initiator !\n");=20 return; } =20=09 @@ -2673,7 +2726,7 @@ con->remote_cid, result); =20=09 if (!con->initiator) {=20 - D_ERR(__FUNCTION__ ": server is not initiator !!!\n");=20 + D_ERR(__FUNCTION__ ": server is not initiator !\n");=20 return; } =20 @@ -2719,30 +2772,11 @@ /* tell upper layers that connection is down */ get_upper(con->psm)->disc_cfm(con); =20 - tmp_hdl =3D con->hci_hdl; - ENTERSTATE(con, CLOSED); PRINTSTATE(con); =20 DSYS("l2cap channel (%d,%d) [%s] disconnected\n",=20 con->local_cid, con->remote_cid, psm2str(con->psm)); - - /* remove l2cap connection */ - delete_con(con); - -#ifdef __KERNEL__ - l2ca_wakeup(__FUNCTION__, con); -#endif - - /* fixme -- if we want to keep baseband connection we must=20 - leave the l2cap connection which holds the hci handle=20 - simply just clear l2cap params but keep hci handle ! */ -=09 - if (count_con(tmp_hdl) =3D=3D 0) { - DSYS(__FUNCTION__ ": (C) no more l2cap connections\n"); - DSYS("Shutdown baseband\n"); - lp_disconnect(tmp_hdl); - } } =20 s32 l2ca_ping(BD_ADDR bd, u8 *opt_data, u16 len) @@ -2787,9 +2821,9 @@ =20 if (con->c_status =3D=3D RES_SUCCESS) { /* check status */ - printk("Now we got baseband, send echo req !\n"); + D_XMIT("Now we got baseband, send echo req !\n"); } else { - printk("Ping failed !\n"); + D_ERR(__FUNCTION__ ": Ping failed !\n"); delete_con(con); return -1; } @@ -2801,15 +2835,13 @@ =20 /* leave loop when either status failed or success */ while (con->c_status =3D=3D CSTATUS_RTX_TIMEOUT) { - printk("Sending echo req...\n"); + D_XMIT("Sending echo req...\n"); l2cap_echo_req(con, opt_data, len);=09 /* wait until we received a response or after timeout */ =20 - printk("Waiting for response or timeout\n"); + D_XMIT("Waiting for response or timeout\n"); =20 l2ca_wait(__FUNCTION__ ": wait echo resp", con); - - printk("Woke up after sending echo req\n"); } =20 if (con->c_status =3D=3D CSTATUS_MAX_NO_RTX) { @@ -2861,9 +2893,9 @@ =20=09=09 if (con->c_status =3D=3D RES_SUCCESS) { /* check status */ - printk("Now we got baseband, send info req !\n"); + D_XMIT("Now we got baseband, send info req !\n"); } else { - printk("GetInfo failed ! [cstatus %d]\n",=20 + D_ERR(__FUNCTION__": GetInfo failed ! [cstatus %d]\n",=20 con->c_status); delete_con(con); return -1; @@ -2876,15 +2908,11 @@ =20 /* leave loop when either status failed or success */ while (con->c_status =3D=3D CSTATUS_RTX_TIMEOUT) { - printk("Sending info req...\n"); + D_XMIT("Sending info req...\n"); l2cap_info_req(con, infotype);=09 - /* wait until we received a response or after timeout */ -=09=09 - printk("Waiting for response or timeout\n"); =20 + /* wait until we received a response or after timeout */ l2ca_wait(__FUNCTION__ ": wait echo resp", con); - - printk("Woke up after sending info req\n"); } =20 return con->c_result; @@ -2931,7 +2959,7 @@ #else /* Usermode stack */ =20 /* FIXME */ - printk("Use NO timer in usermode stack yet...\n"); + D_ERR("Use NO timer in usermode stack yet...\n"); return; #if 0 struct itimerval t =3D {{0,0},{timeout, 0}}; @@ -3010,7 +3038,7 @@ D_TIM("ERTX never started\n"); #else /* Usermode stack */ /* FIXME */ - printk("disable_ertx FIXME\n"); + D_ERR("disable_ertx FIXME\n"); con->timer.ertx_inuse =3D 0; con->timer.ertx_action =3D ERTX_ACTION_DISCONNECT; #endif |
From: Mattias A. <mat...@us...> - 2001-04-25 16:54:47
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.c 1.142 1.143=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * only wakeup hci_wq in COMMAND_COMPLETE (not COMMAND_STATUS) * added read transmit power level * added CONFIG_BLUETOOTH_EARLY_MSSWITCH which forces m/s switch in=20 lp_connect_rsp. If not defined, acl link is first established and then a role switch is performed. (Requires scatternet functionality=20 if more than on slave).=20 * added ifdef __KERNEL__ around 2 sleeps (usermode stack) * cleaned up The diff of the modified file(s): --- hci.c 2001/04/19 07:02:04 1.142 +++ hci.c 2001/04/25 16:54:47 1.143 @@ -721,7 +721,9 @@ /* we demand role switch as server */ if (force_msswitch && !i_am_initiator) { /* FIXME -- check return code */ +#ifndef CONFIG_BLUETOOTH_EARLY_MSSWITCH hci_switch_role(buf + 3, 0); +#endif } /* reset variable again */ i_am_initiator =3D 0; @@ -826,7 +828,7 @@ break; =20 case QOS_SETUP_COMPLETE: - DSYS(__FUNCTION__", QOS_SETUP_COMPLETE Not implemented!\n"); + DSYS(__FUNCTION__", QOS_SETUP_COMPLETE\n"); break; =20 case COMMAND_COMPLETE: @@ -844,12 +846,16 @@ performing the task for this command */ =20=09=09 case COMMAND_STATUS: - release_cmd_timer(); - /*FIXME: hci_switch_role() will generate COMMAND_STATUS that - shouldn't call wake_up_interruptible() */ +=09=09 D_CMD(__FUNCTION__", COMMAND_STATUS\n"); =20=09=09 if (buf[0]) { + + /* fixme -- add parser for command status e.g when trying + to connect an acl link which already is connected, a + command status with "ACL link already exist" is returned=20 + This must be signalled using lp_connect_cfm (neg) + */ D_ERR(__FUNCTION__", COMMAND_STATUS: %s\n",get_err_msg(buf[0])); #ifdef USE_INQTIMER if (hci_inq_pending) @@ -858,7 +864,6 @@ } =20=09=09 update_nhcp(buf[1]); - wake_up_interruptible(&hci_wq); break; case FLUSH_OCCURRED: D_CMD(__FUNCTION__", FLUSH_OCCURRED on hci_hdl %d\n", @@ -876,6 +881,9 @@ if (buf[0]) {=20 D_ERR(__FUNCTION__", Role changed failed due to %s\n", get_err_msg(buf[0])); +=09=09=09 + /* fixme -- Notify l2cap that this BD will go down */ +=09=09=09 } else if (buf[7]) { DSYS(__FUNCTION__", Current master is 0x%04x%08x\n",=20 CHAR2INT16(buf[6], buf[5]),=20 @@ -1143,6 +1151,19 @@ CHAR2INT16(r_val[2], r_val[1])); break;=09 =20=20=20=20=20=20=20=20=20=20=20=20=20 + case READ_TRANSMIT_POWER_LEVEL:=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 +=09=09=20=20 + printk(__FUNCTION__", READ_TRANSMIT_POWER_LEVEL\n"); + if (r_val[0]) { + D_ERR(__FUNCTION__", READ_TRANSMIT_POWER_LEVEL: %s\n", + get_err_msg(r_val[0])); + break; + } else { + unsigned short hci_hdl =3D CHAR2INT12(r_val[2], r_val[1]); + DSYS("READ_TRANSMIT_POWER_LEVEL : handle %d, %d dBm\n", hci_hdl, r_val= [3]); + } + break; + case SET_HOST_CONTROLLER_TO_HOST_FLOW_CONTROL: D_CMD(__FUNCTION__", SET_HOST_CONTROLLER_TO_HOST_FLOW_CONTROL\n"); if (r_val[0]) { @@ -1333,15 +1354,6 @@ break; } =20=09=09=09 - hci_ctrl.hc_buf.acl_len =3D CHAR2INT16(r_val[2],r_val[1]); - hci_ctrl.hc_buf.sco_len =3D (u32) r_val[3]; - hci_ctrl.hc_buf.acl_num =3D CHAR2INT16(r_val[5],r_val[4]); - hci_ctrl.hc_buf.sco_num =3D CHAR2INT16(r_val[7],r_val[6]); - printk("\nHW module contains...\n"); - printk("%d ACL buffers at %d bytes\n%d SCO buffers at %d bytes\n\n", - hci_ctrl.hc_buf.acl_num, hci_ctrl.hc_buf.acl_len, - hci_ctrl.hc_buf.sco_num, hci_ctrl.hc_buf.sco_len); - break; =20 case READ_BUFFER_SIZE: @@ -1365,6 +1377,7 @@ hw.max_acl_num =3D hci_ctrl.hc_buf.acl_num; #endif #endif + wake_up_interruptible(&hci_wq); break; =20=20=20=20=20=20=20=20=20=20=20=20=20 case READ_BD_ADDR: @@ -1710,13 +1723,9 @@ send_data_task.data =3D NULL; #endif =20 - /* Disable parity bit and set to H4 IF + flow ctrl */ - /* Not activated until after reset !!!! */ - /* always... */ DSYS(__FUNCTION__", Reading buffer sizes in the module...\n"); hci_read_buffer_size(HCI_BLOCK); - hci_read_firmware_rev_info();=09 =20 #ifdef HOST_FLOW_CTRL @@ -1731,11 +1740,24 @@ start_ncp_timer();=09 #endif =20 +#ifdef CONFIG_BLUETOOTH_ENABLE_MSSWITCH + DSYS("M/S switch enabled\n"); + +#ifdef CONFIG_BLUETOOTH_CSR + /* CSR can't do scatternet yet, so we need to do m/s switch=20 + as early as in lp_connect_rsp */ +#define CONFIG_BLUETOOTH_EARLY_MSSWITCH +#endif + #ifdef CONFIG_BLUETOOTH_FORCE_MSSWITCH hci_force_msswitch(1); #else hci_force_msswitch(0); #endif=20=20=20=20=20=20=20 + +#else /* CONFIG_BLUETOOTH_ENABLE_MSSWITCH */ + DSYS("M/S switch disabled\n"); +#endif } =20 void=20 @@ -1795,7 +1817,6 @@ tmp =3D send_inq_cmd_block((u8*) &c_pkt,=20 c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN, inq_len); - return tmp; } =20 @@ -2127,7 +2148,7 @@ s32 hci_switch_role(u8 *bd, u8 role) { - printk(__FUNCTION__": role:%d\n", role); + DSYS(__FUNCTION__": role %d\n", role); =20 c_pkt.type =3D CMD_PKT; c_pkt.opcode =3D hci_put_opcode(SWITCH_ROLE, HCI_LP) ; @@ -2357,7 +2378,7 @@ s32=20 hci_write_scan_enable(u32 enable) { - printk(__FUNCTION__", enable %d\n", enable); + D_CMD(__FUNCTION__", enable %d\n", enable); c_pkt.type =3D CMD_PKT; c_pkt.opcode =3D hci_put_opcode(WRITE_SCAN_ENABLE, HCI_HC) ; =20=20=20 @@ -2576,6 +2597,20 @@ #endif } =20 +s32 +hci_read_power_transmit_level(u32 con_hdl, unsigned char type) +{ + D_CMD(__FUNCTION__"\n"); + c_pkt.type =3D CMD_PKT; + c_pkt.opcode =3D hci_put_opcode(READ_TRANSMIT_POWER_LEVEL, HCI_LP) ; + c_pkt.len =3D 3; + c_pkt.data[0] =3D con_hdl & 0xff; + c_pkt.data[1] =3D (con_hdl >> 8) & 0xff; + c_pkt.data[2] =3D type; +=09 + return send_cmd((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LE= N); +} + /* The hci_host_buffer_size function is used by the Host to notify the Host Controller about the maximum size of the data portion of HCI ACL and SCO Data Packets sent from the Host Controller to the Host. The Host @@ -2728,7 +2763,6 @@ memset(bd, 0, 6);=20 =20 tmp =3D send_cmd_block((u8*) &c_pkt ,c_pkt.len + CMD_HDR_LEN + HCI_HDR_LE= N); - memcpy(bd, hci_ctrl.local_bd, 6); return tmp; }=20 @@ -2858,7 +2892,7 @@ void hci_force_msswitch(u8 enable) { - printk("Setting force_msswitch to %d\n", enable); + DSYS("Force M/S switch set to %d\n", enable); force_msswitch =3D enable;=20 } =20 @@ -2889,7 +2923,18 @@ {=20 D_CMD(__FUNCTION__"Status:%d\n", cfm); if (cfm) { +#ifdef CONFIG_BLUETOOTH_EARLY_MSSWITCH + if (force_msswitch) { + DSYS("lp_connect_rsp : early m/s switch\n"); + return accept_connection_request(bd_addr, MS_SWITCH_BECOME_MASTER); + } else + return accept_connection_request(bd_addr, MS_SWITCH_REMAIN_SLAVE); + +#else return accept_connection_request(bd_addr, MS_SWITCH_REMAIN_SLAVE); +#endif + + } else { return reject_connection_request(bd_addr, 0x0d); /* FIXME: 0x0d =3D due to limited resourses store this @@ -2956,12 +3001,14 @@ decreased by one and checks whether there are more packets to send. Turn off interrupts since number_of_completed_packets interrupt can change hci_ctrl.hc_buf.acl_num. */ -=09 cli(); while ((hci_ctrl.hc_buf.acl_num > 0) && bytes2send) { hci_ctrl.hc_buf.acl_num--; sti(); =20=09=09 + /* FIXME -- what if send_acl_packet fails ???=20 + Then acl_num will decrease anyway ... */=20 + bytes2send -=3D send_acl_packet(tx_buf); =20=09=09 D_QUEUE("<--%d (%d)\n", buf_byte_count(),=20 @@ -3184,9 +3231,10 @@ D_CMD(__FUNCTION__", ACCEPT_CONNECTION->connection complete\n"); o_len =3D set_con_cpl_event(out_event, 0, cmd->data, HCI_HDL, ACL_CON); +#ifndef __KERNEL__ sleep(1); +#endif bt_write_lower_driver(o_event, o_len); -=20=20=20=20=20=20 lp_connect_cfm(data + 4, 0, 0); break; =20=20=20=20=20=20=20 @@ -3194,7 +3242,9 @@ D_CMD(__FUNCTION__", REJECT_CONNECTION->connection complete\n"); o_len =3D set_con_cpl_event(out_event, cmd->data[6], cmd->data, HCI_HDL, ACL_CON); +#ifndef __KERNEL__ sleep(1); +#endif bt_write_lower_driver(o_event, o_len); lp_connect_cfm(data + 4, 0xd, 0); break; @@ -3631,7 +3681,7 @@ up(&hci_cmd_semaphore); #else while (hci_cmd_pending)=09=09 - usleep(50000); + usleep(10000); #endif=20=20=20=20=20=20=20 return tmp; } |
From: Mattias A. <mat...@us...> - 2001-04-25 16:49:25
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- btmem.c 1.40 1.41=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * added call to get_bt_buf in btmem_flushhandle which removes all buffers= =20 located in queue head The diff of the modified file(s): --- btmem.c 2001/03/30 11:04:27 1.40 +++ btmem.c 2001/04/25 16:49:24 1.41 @@ -208,6 +208,9 @@ D_MEM("btmem_flushhandle : flushed %d buffers\n", i); =20 sti(); + /* get_bt_buf removes flushed buffers if located in=20 + queue head */ + get_bt_buf(); } =20 =20 @@ -412,7 +415,8 @@ /* Check if chunk is valid */ if (tx->flushed) { /* This buffer is flushed */ - DSYS("get_bt_buf : Flushing this buffer\n"); + DSYS("get_bt_buf : Flushing this buffer [handle %d]\n", + tx->hci_hdl); #if BTMEM_FLUSH_ENABLED unsubscribe_bt_buf(tx); return get_bt_buf(); /* Yeehaa, more recursion :) */ |
From: Peter K. <pk...@us...> - 2001-04-20 17:52:09
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- l2cap.c 1.103 1.104=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Indentation fix. |
From: Gordon M. <gm...@us...> - 2001-04-20 17:19:07
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- l2cap.c 1.102 1.103=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: --Mattias Agren's REAL fix for the NULL pointer dereference in process_event The diff of the modified file(s): --- l2cap.c 2001/04/19 14:37:33 1.102 +++ l2cap.c 2001/04/20 17:19:06 1.103 @@ -932,19 +932,20 @@ opt_len =3D rsp->len - sizeof(sig_cmdreject); switch (cmdreject->reason) { case 0: - D_STATE(__FUNCTION__ ": Command not understood\n");=20 + D_ERR(__FUNCTION__ ": Command not understood\n");=20 break; =20=20=20=20=20=20=20=20=20=20=20=20 case 1: - D_STATE(__FUNCTION__ ": Signalling MTU exceeded\n"); + D_ERR(__FUNCTION__ ": Signalling MTU exceeded\n"); break; =20=20=20=20=20=20=20=20=20=20=20=20 case 2: - D_STATE(__FUNCTION__ ": Invalid CID in request\n"); + D_ERR(__FUNCTION__ ": Invalid CID in request\n"); break; =20=20=20=20=20=20=20=20=20=20=20=20 default: - D_STATE(__FUNCTION__ ": Not recognized cmd reject reason\n"); + D_ERR(__FUNCTION__ ": Unrecognized cmd reject "\ + "reason\n"); break; } =20=09=09 @@ -952,22 +953,14 @@ print_data(__FUNCTION__ ": optional data : ",=20 cmdreject->data, rsp->len-2); =20 - /* Find connection -- note that I'm not sure this is the right thing - to do here. I just wanted to make sure we don't try to dereference - a null 'con' pointer like we used to do. Mattias Agren promised - to check in a real fix when he brings some other changes in. - --gmcnutt (4/19/01) - */ - if ((conrsp =3D (sig_conrsp *)rsp->data) =3D=3D NULL) { - D_ERR(__FUNCTION__ ": no response data\n"); - return; - } + /* find connection object using id field */ =20 - if ((con =3D get_lcon(conrsp->src_cid)) =3D=3D NULL) { - D_ERR(__FUNCTION__ ": no connection\n"); - return; - } + con =3D get_first_con(); +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 + while (con && (con->sig_id_sent !=3D rsp->id)) + con =3D get_next_con(con); =20 + if (con) {=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20 /* fixme -- set 'real' reason code */ con->c_status =3D CSTATUS_CMDREJECT; =20=09=09 @@ -976,6 +969,9 @@ #ifdef CONFIG_BLUETOOTH_L2CAP_USE_TIMERS=09=09 disable_rtx(con); #endif + } else + D_ERR(__FUNCTION__ ": Could not find an l2cap "\ + "connection for this ID\n"); break; =20=20=20=20=20=20=20=20 case SIG_CONRSP: |
From: <mat...@ax...> - 2001-04-20 17:10:24
|
> + if ((conrsp = (sig_conrsp *)rsp->data) == NULL) { > + D_ERR(__FUNCTION__ ": no response data\n"); > + return; > + } > + > + if ((con = get_lcon(conrsp->src_cid)) == NULL) { > + D_ERR(__FUNCTION__ ": no connection\n"); > + return; > + } Why are you casting the received data as a connection response ?!? The command reject only contain reason + ID for the rejected packet and some optional data (reason 1 => 'correct' MTU, reason = 2 => requested CID) This is what I have in my l2cap.c ==== case SIG_CMDREJECT: D_STATE(FNC"Command reject - \n"); DSYS("Got command reject\n"); cmdreject = (sig_cmdreject*)rsp->data; cmdreject->reason = le16_to_cpu(cmdreject->reason); opt_len = rsp->len - sizeof(sig_cmdreject); switch (cmdreject->reason) { case 0: D_ERR(FNC"Command not understood\n"); break; case 1: D_ERR(FNC"Signalling MTU exceeded\n"); break; case 2: D_ERR(FNC"Invalid CID in request\n"); break; default: D_STATE(FNC"Not recognized cmd reject reason\n"); break; } if (opt_len > 0) print_data(FNC"optional data : ", cmdreject->data, rsp->len-2); /* find connection object using id field */ con = get_first_con(); while (con && (con->sig_id_sent != rsp->id)) con = get_next_con(con); if (con) { /* fixme -- set 'real' reason code */ con->c_status = CSTATUS_CMDREJECT; l2ca_wakeup("l2cap cmd reject", con); #ifdef CONFIG_BLUETOOTH_L2CAP_USE_TIMERS disable_rtx(con); #endif } else D_ERR("Could not find l2cap connection for this ID\n"); break; ==== I haven't tested it yet but if it works you could check it in if you want. Hopefully I will be able to get the rest finished early next week. brgds Mattias |
From: Peter K. <pk...@us...> - 2001-04-20 16:12:14
|
The following files were modified in apps/bluetooth/btd: Name Old version New version Comment ---- ----------- ----------- ------- btd.c 1.93 1.94=20=20=20=20=20=20=20=20=20=20=20=20 btd.h 1.35 1.36=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Use bt_hw_vendor() to identify which kind of hardware is used, instead of deciding this when compiling. The diff of the modified file(s): --- btd.c 2001/04/18 11:50:32 1.93 +++ btd.c 2001/04/20 16:12:14 1.94 @@ -300,6 +300,9 @@ static void read_local_bd(int bt_cfd, unsigned char *bd_addr); static void read_remote_bd(int bt_cfd, unsigned char *bd_addr); static void role_switch(int bt_cfd, unsigned char *bd_addr, int role); +#ifndef BTD_USERSTACK +static char* bt_hw_vendor(void); +#endif static void reset_hw(void); static void bt_set_classofdevice(int bt_fd, unsigned short service_class, = unsigned char major_class, unsigned char minor_class, unsigned char format); =20 @@ -307,10 +310,25 @@ /* Misc */ static void show_menu(void); =20 -#if defined(CONFIG_BLUETOOTH_ERICSSON)&&defined(__CRIS__) -#define ECS_TEST_FUNCTIONS -#endif +static int hw_vendor(void); + +static void ericsson_init_phys(int fd); +static void ericsson_init_hw(int spd); +static void csr_init_phys(int fd); +static void csr_init_hw(int spd); +static void digianswer_init_phys(int fd); +static void digianswer_init_hw(int spd); +static void usb_init_phys(int fd); +static void usb_init_hw(int spd); +static void generic_init_phys(int fd); +static void generic_init_hw(int spd); +static void no_init_phys(int fd); +static void no_init_hw(int spd); +static void unknown_init_phys(int fd); +static void unknown_init_hw(int spd); =20 +#undef ECS_TEST_FUNCTIONS + #ifdef ECS_TEST_FUNCTIONS static void enable_dut(int bt_cfd); static void test_connection_req(int* bd); @@ -396,6 +414,15 @@ =20 #define BTD_HISTORY_FILE "/tmp/btd_history" =20 +#define HW_NOT_PROBED -1 +#define HW_ERICSSON 0 +#define HW_CSR 1 +#define HW_DIGIANSWER 2 +#define HW_USB 3 +#define HW_GENERIC 4 +#define HW_NO_INIT 5 +#define HW_UNKNOWN 6 + /*=20 Bluetooth discipline define. Should reside in /include/asm/termios.h However, if compiling this standalone simply use the define in bluetoot= h.h @@ -2854,7 +2881,6 @@ bt_disconnect(int bt_fd, unsigned int con_id) { #ifndef BTD_USERSTACK - if (ioctl(bt_fd, BTDISCONNECT, &con_id) < 0) { perror("Disconnect"); @@ -3111,6 +3137,23 @@ #endif } =20 +#ifndef BTD_USERSTACK +char* +bt_hw_vendor(void) +{ + int bt_cfd =3D open(BT_CTRL_TTY, O_RDWR | O_NOCTTY); + static char buffer[20]; + + if (bt_cfd < 0 || ioctl(bt_cfd, BTHWVENDOR, buffer) < 0) + { + perror(__FUNCTION__); + return NULL; + } + close(bt_cfd); + return buffer; +} +#endif + void reset_hw(void) { @@ -3145,26 +3188,130 @@ /****************** Vendor dependent functions ***********************/ /*********************************************************************/ =20 -#if defined(CONFIG_BLUETOOTH_ERICSSON) +void +init_phys(int fd) +{ + switch (hw_vendor()) + { + case HW_ERICSSON: + ericsson_init_phys(fd); + break; + + case HW_CSR: + csr_init_phys(fd); + break; + + case HW_DIGIANSWER: + digianswer_init_phys(fd); + break; + + case HW_USB: + usb_init_phys(fd); + break; + + case HW_GENERIC: + generic_init_phys(fd); + break; + + case HW_NO_INIT: + no_init_phys(fd); + break; =20 + case HW_UNKNOWN: + default: + unknown_init_phys(fd); + break; + } +} + +void +init_hw(int spd) +{ + switch (hw_vendor()) + { + case HW_ERICSSON: + ericsson_init_hw(spd); + break; + + case HW_CSR: + csr_init_hw(spd); + break; + + case HW_DIGIANSWER: + digianswer_init_hw(spd); + break; + + case HW_USB: + usb_init_hw(spd); + break; + + case HW_GENERIC: + generic_init_hw(spd); + break; + + case HW_NO_INIT: + no_init_hw(spd); + break; + + case HW_UNKNOWN: + default: + unknown_init_hw(spd); + break; + } +} + +int +hw_vendor(void) +{ + static int hw_vendor =3D HW_NOT_PROBED; + + if (hw_vendor =3D=3D HW_NOT_PROBED) + { + char *vendor =3D bt_hw_vendor(); + + if (!vendor) + hw_vendor =3D HW_UNKNOWN; + else if (!strcmp(vendor, "Ericsson")) + hw_vendor =3D HW_ERICSSON; + else if (!strcmp(vendor, "CSR")) + hw_vendor =3D HW_CSR; + else if (!strcmp(vendor, "Digianswer")) + hw_vendor =3D HW_DIGIANSWER; + else if (!strcmp(vendor, "USB")) + hw_vendor =3D HW_USB; + else if (!strcmp(vendor, "Generic")) + hw_vendor =3D HW_GENERIC; + else if (!strcmp(vendor, "No Init")) + hw_vendor =3D HW_NO_INIT; + else + hw_vendor =3D HW_UNKNOWN; + } + + return hw_vendor; +} + +/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ +/* Ericsson specific commands */ +/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ + /* Set the phys device to Ericsson default speed, 57600 */ -void init_phys(int fd) +void +ericsson_init_phys(int fd) { fd_setup(fd, 57600, USE_FLOW_CTRL); } =20 void -init_hw(int spd) +ericsson_init_hw(int spd) { - /* - wait for Ericsson module to boot if running this app - directly at startup=20 - */ #ifndef BTD_USERSTACK unsigned int wrscan =3D (PAGE_SCAN_ENABLE | INQUIRY_SCAN_ENABLE); unsigned char evfilter[3]; =20=20=20 + /* wait for Ericsson module to boot if running this app directly at star= tup=20 + */ sleep(1); + printf("Setting write_scan_enable in Ericsson module!\n"); if (ioctl(bt_cfd, HCIWRITESCANENABLE, &wrscan) < 0) {=20 @@ -3191,7 +3338,6 @@ perror("HCISETBAUDRATE"); exit(1); } -=20=20=20=20=20 #else=20=20 printf("Setting write_scan_enable in Ericsson module!\n"); hci_write_scan_enable(PAGE_SCAN_ENABLE|INQUIRY_SCAN_ENABLE);=09=09 @@ -3203,49 +3349,21 @@ hci_set_baudrate(spd);=20=20 #endif } - -#elif defined(CONFIG_BLUETOOTH_DIGIANSWER) -/*********************************************************************/ -/*********************************************************************/ - -/* Set the phys device to Digianswer default, 9600 */=20 -void init_phys(int fd) -{ - fd_setup(fd, 9600, USE_FLOW_CTRL); -} - -void -init_hw(int spd) -{ - printf("Setting baudrate in Digianswer PC card\n"); -#ifndef BTD_USERSTACK - if (ioctl(bt_cfd, HCISETBAUDRATE, &spd) < 0) - { - perror("HCISETBAUDRATE"); - exit(1); - } -#else - hci_set_baudrate(spd); -#if DIGI_DONGLE_SUPPORT - // FIXME - what to do about this? - hci_set_baudrate(115200); -#endif - -#endif -} =20 -#elif defined(CONFIG_BLUETOOTH_CSR) -/*********************************************************************/ -/*********************************************************************/ +/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ +/* CSR specific commands */ +/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ =20 /* Set the phys device to CSR default, 115200 */=20 -void init_phys(int fd) +void +csr_init_phys(int fd) { fd_setup(fd, 115200, USE_FLOW_CTRL); } =20 +/* fixme -- remove hardcoded values */ void -init_hw(int spd) +csr_init_hw(int spd) {=20=20 #ifndef BTD_USERSTACK unsigned int wrscan =3D (PAGE_SCAN_ENABLE | INQUIRY_SCAN_ENABLE); @@ -3281,8 +3399,6 @@ perror("HCISET_EVENT_FILTER"); exit(1); } - - #else printf("Setting write_scan_enable in CSR module!\n"); hci_write_scan_enable(PAGE_SCAN_ENABLE|INQUIRY_SCAN_ENABLE); @@ -3292,18 +3408,49 @@ #endif } =20 -#elif defined(CONFIG_BLUETOOTH_GENERIC) -/*********************************************************************/ -/*********************************************************************/ +/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ +/* Digianswer specific commands */ +/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ =20 -/* Set the phys device to something, e.g. 115200 */=20 -void init_phys(int fd) +/* Set the phys device to Digianswer default, 9600 */=20 +void +digianswer_init_phys(int fd) +{ + fd_setup(fd, 9600, USE_FLOW_CTRL); +} + +void +digianswer_init_hw(int spd) +{ + printf("Setting baudrate in Digianswer PC card\n"); +#ifndef BTD_USERSTACK + if (ioctl(bt_cfd, HCISETBAUDRATE, &spd) < 0) { + perror("HCISETBAUDRATE"); + exit(1); + } +#else + hci_set_baudrate(spd); +#if DIGI_DONGLE_SUPPORT + // FIXME - what to do about this? + hci_set_baudrate(115200); +#endif + +#endif /* BTD_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=3D*/ +/* USB specific commands */ +/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ + +void +usb_init_phys(int fd) +{ fd_setup(fd, 115200, USE_FLOW_CTRL); } =20 void -init_hw(int spd) +usb_init_hw(int spd) { #ifndef BTD_USERSTACK unsigned int wrscan =3D (PAGE_SCAN_ENABLE | INQUIRY_SCAN_ENABLE); @@ -3321,39 +3468,65 @@ #endif } =20 -#elif defined(CONFIG_BLUETOOTH_NOINIT) -/*********************************************************************/ -/*********************************************************************/ +/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ +/* Generic commands */ +/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ =20 -/* Set the phys device to something, e.g. 115200 */=20 -void init_phys(int fd) +void +generic_init_phys(int fd) { - printf("init_phys: No hardware.\n"); + fd_setup(fd, 115200, USE_FLOW_CTRL); } =20 void -init_hw(int spd) +generic_init_hw(int spd) { - printf("No hw init done\n"); -} +#ifndef BTD_USERSTACK + unsigned int wrscan =3D (PAGE_SCAN_ENABLE | INQUIRY_SCAN_ENABLE); + sleep(1); + printf("Setting write_scan_enable in USB module!\n"); =20 + if (ioctl(bt_cfd, HCIWRITESCANENABLE, &wrscan) < 0) + {=20 + perror("HCIWRITESCANENABLE"); + exit(1); + } #else -/*********************************************************************/ -/*********************************************************************/ + hci_write_scan_enable(PAGE_SCAN_ENABLE|INQUIRY_SCAN_ENABLE); + sleep(1); /* wait for HW */ +#endif +} =20 -void init_phys(int fd) +/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ +/* No HW init commands */ +/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ + +void +no_init_phys(int fd) +{ +} + +void +no_init_hw(int spd) { +} + +/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ +/* Default */ +/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ + +void +unknown_init_phys(int fd) +{ printf("ERROR: init_phys() not implemented!\n"); } =20 void -init_hw(int spd) +unknown_init_hw(int spd) { printf("ERROR: init_hw() not implemented!\n"); } =20 -#endif /* HW_USED() */ - /*********************************************************************/ /***************** Ericsson test functions ***************************/ /***************** This will be moved later **************************/ @@ -3463,7 +3636,6 @@ { perror("test con req"); } -=20=20 #else hdl =3D hci_test_connect_req(btcon.bd); #endif @@ -3479,7 +3651,6 @@ unsigned char test_msg[17]; int i; =20 -=20=20 ecs_test_msg[0] =3D CMD_PKT; ecs_test_msg[1] =3D OPCODE_LSB(ERICSSON_TX_TEST, MANUFACTURER_SPEC); ecs_test_msg[2] =3D OPCODE_MSB(ERICSSON_TX_TEST, MANUFACTURER_SPEC); @@ -3510,7 +3681,6 @@ printf("Length_Of_Test_Data : 0x%x\n", tmp[10]); =20=20=20 #ifndef BTD_USERSTACK - test_msg[0] =3D 17; memcpy(test_msg + 1, ecs_test_msg, 17); =20=20=20 @@ -3521,9 +3691,10 @@ #else hci_send_raw_data(test_msg, 17); #endif + printf("TX test starting.\n"); } -#endif +#endif /* ECS_TEST_FUNCTIONS */ =20 /*********************************************************************/ /*********************************************************************/ --- btd.h 2001/03/05 16:57:54 1.35 +++ btd.h 2001/04/20 16:12:14 1.36 @@ -46,24 +46,6 @@ =20 /****************** CONSTANT AND MACRO SECTION ***************************= ***/ =20 -/* HW init defines */ - -/* Let us assume that if CONFIG_BLUETOOTH is definend (from the kernel - includes), then CONFIG_BLUETOOTH_<hardware> is also defined correctly */ -#ifndef CONFIG_BLUETOOTH - -/* Define the one of these that matches the used hardware */ -#undef CONFIG_BLUETOOTH_NOINIT=20=20=20=20=20 -#undef CONFIG_BLUETOOTH_CSR=20=20=20=20=20=20=20=20 -#undef CONFIG_BLUETOOTH_DIGIANSWER=20 -#define CONFIG_BLUETOOTH_ERICSSON -#undef CONFIG_BLUETOOTH_GENERIC=20=20=20=20 -#undef CONFIG_BLUETOOTH_USBMODULE /* Not implemented */ - -#endif CONFIG_BLUETOOTH - -/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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 the BT driver */ =20 #define BT_IOC_MAGIC 'B' /* Use B as a magic number */ @@ -81,6 +63,7 @@ #define BTREADREMOTEBDADDR _IOR(BT_IOC_MAGIC, 0x07, unsigned char[6]) #define BTRESETPHYSICALHW _IO(BT_IOC_MAGIC, 0x08) #define BTISINITIATED _IOR(BT_IOC_MAGIC, 0x09, int) +#define BTHWVENDOR _IOR(BT_IOC_MAGIC, 0x0A, char[20]) =20 /* ioctls executing HCI commands */ =20 @@ -144,8 +127,6 @@ #define INQUIRY_SCAN_ENABLE 1 #define PAGE_SCAN_ENABLE 2 =20 -/****************** TYPE DEFINITION SECTION ******************************= ***/ - #define SDP_LAYER 1 #define RFCOMM_LAYER 3 #define TCS_LAYER 5 @@ -153,13 +134,16 @@ #define CREATE_RFCOMM_ID(line, dlci) ( ((RFCOMM_LAYER << 16)&0xffff0000) |= ((line<<8)&0xff00) | ((dlci) & 0xff) ) #define GET_PSM(con_id) (con_id >> 16) =20 +/****************** TYPE DEFINITION SECTION ******************************= ***/ =20 -typedef struct bt_connection{ +typedef struct bt_connection +{ unsigned char bd[6]; unsigned int id; /* | psm(16 bits)=A0| layer_specific (16 bits)=A0|=A0*/ } bt_connection; =20 -typedef struct inquiry_results { +typedef struct inquiry_results +{ unsigned int nbr_of_units; unsigned int inq_time; unsigned char bd_addr[0]; |
From: Peter K. <pk...@us...> - 2001-04-20 16:11:36
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- bt_conf.h 1.3 1.4=20=20=20=20=20=20=20=20=20=20=20=20=20 bt_vendor.c 1.8 1.9=20=20=20=20=20=20=20=20=20=20=20=20=20 bt_vendor.h 1.1 1.2=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Use bt_hw_vendor() to identify which kind of hardware is used, instead of deciding this when compiling. The diff of the modified file(s): --- bt_conf.h 2001/04/17 10:38:18 1.3 +++ bt_conf.h 2001/04/20 16:11:35 1.4 @@ -42,18 +42,6 @@ #ifndef __BT_CONF_H__ #define __BT_CONF_H__ =20 -#define HW_NOINIT 0 -#define HW_ERICSSON 1 -#define HW_DIGIANSWER 2 -#define HW_CSR 3 -#define HW_GENERIC 4 -#define HW_USBMODULE 5 /* Not implemented */ - -/* This sets current HW in usermode application */ -#define HW_CURRENT HW_CSR - -#define HW_USED(x) (HW_CURRENT =3D=3D x) - /* =3D=3D=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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D*/ =20 #define BT_NBR_DATAPORTS 7 --- bt_vendor.c 2001/04/17 17:35:03 1.8 +++ bt_vendor.c 2001/04/20 16:11:35 1.9 @@ -50,189 +50,224 @@ #include "bt_vendor.h" #include "bt_if.h" =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=3D*/ -/* Ericsson specific commands */ -/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ +#define HW_NOT_PROBED -1 +#define HW_ERICSSON 0 +#define HW_CSR 1 +#define HW_DIGIANSWER 2 +#define HW_USB 3 +#define HW_GENERIC 4 +#define HW_NO_INIT 5 +#define HW_UNKNOWN 6 =20 -#if HW_USED(HW_ERICSSON) +static int hw_vendor(void); =20 -/* Set the phys device to Ericsson default speed, 57600 */ -void init_phys(int fd) -{ - fd_setup(fd, 57600, USE_FLOW_CTRL); -} +static void ericsson_init_phys(int fd); +static void ericsson_init_hw(int bt_cfd, int phys_fd, int spd); +static void csr_init_phys(int fd); +static void csr_init_hw(int bt_cfd, int phys_fd, int spd); +static void digianswer_init_phys(int fd); +static void digianswer_init_hw(int bt_cfd, int phys_fd, int spd); +static void usb_init_phys(int fd); +static void usb_init_hw(int bt_cfd, int phys_fd, int spd); +static void generic_init_phys(int fd); +static void generic_init_hw(int bt_cfd, int phys_fd, int spd); +static void no_init_phys(int fd); +static void no_init_hw(int bt_cfd, int phys_fd, int spd); +static void unknown_init_phys(int fd); +static void unknown_init_hw(int bt_cfd, int phys_fd, int spd); =20 void -init_hw(int bt_cfd, int phys_fd, int spd) +init_phys(int fd) { - bt_write_scan_enable(bt_cfd, 0 /* inpars not used */); - - sleep(1); + switch (hw_vendor()) + { + case HW_ERICSSON: + ericsson_init_phys(fd); + break; =20 - /* set_event_filter must be called for m/s switch on IrmaC! */ - bt_set_event_filter(bt_cfd, 0 /* inpars not used */); + case HW_CSR: + csr_init_phys(fd); + break; =20 - sleep(1); // wait for HW... + case HW_DIGIANSWER: + digianswer_init_phys(fd); + break; =20 - printf("Setting baudrate in Ericsson module!\n");=20=20 - bt_set_baudrate(bt_cfd, spd); + case HW_USB: + usb_init_phys(fd); + break; =20=20=20 - /* Now set phys device speed to whatever HW was set to use */ - fd_setup(phys_fd, spd, USE_FLOW_CTRL); - tcflush(phys_fd, TCIOFLUSH); -} + case HW_GENERIC: + generic_init_phys(fd); + break; =20 -/* Ericsson specific test commands sent through RAW interface */ -#ifdef ECS_TEST_FUNCTIONS + case HW_NO_INIT: + no_init_phys(fd); + break; =20 -#define ERICSSON_ENTER_TEST_MODE 0x11 -#define ERICSSON_TEST_CONTROL 0x12 -#define ERICSSON_TX_TEST 0x19 + case HW_UNKNOWN: + default: + unknown_init_phys(fd); + break; + } +} =20 void -ericsson_test_control(int bt_cfd, int* tmp) +init_hw(int bt_cfd, int phys_fd, int spd) { - unsigned char ecs_test_msg[16]; - unsigned char test_msg[64]; - unsigned short hdl =3D (unsigned short)tmp[0]; - int i; - - ecs_test_msg[0] =3D CMD_PKT; - ecs_test_msg[1] =3D OPCODE_LSB(ERICSSON_TEST_CONTROL, MANUFACTURER_SPEC); - ecs_test_msg[2] =3D OPCODE_MSB(ERICSSON_TEST_CONTROL, MANUFACTURER_SPEC); - ecs_test_msg[3] =3D 12; + switch (hw_vendor()) + { + case HW_ERICSSON: + ericsson_init_hw(bt_cfd, phys_fd, spd); + break; =20 - /* connection handle */ - ecs_test_msg[4] =3D (unsigned char)(hdl & 0xff);=20=20=20=20 - ecs_test_msg[5] =3D (unsigned char)((hdl >> 8) & 0xff); + case HW_CSR: + csr_init_hw(bt_cfd, phys_fd, spd); + break; =20 - /* cast ints to to uchars */ - for (i =3D 6; i < 13; i++) - { - ecs_test_msg[i] =3D (unsigned char)tmp[i-6]; - } + case HW_DIGIANSWER: + digianswer_init_hw(bt_cfd, phys_fd, spd); + break; =20 - /* length */ - ecs_test_msg[14] =3D (unsigned char)(tmp[8] & 0xff);=20=20=20=20 - ecs_test_msg[15] =3D (unsigned char)((tmp[8] >> 8) & 0xff); + case HW_USB: + usb_init_hw(bt_cfd, phys_fd, spd); + break; =20 - printf("*** Sending Ericsson_Test_Control with params : ***\n"); + case HW_GENERIC: + generic_init_hw(bt_cfd, phys_fd, spd); + break; =20 - printf("Connection handle : 0x%x\n", hdl); - printf("Test_Scenario : 0x%x\n", ecs_test_msg[6]); - printf("Hopping_Mode : 0x%x\n", ecs_test_msg[7]); - printf("TX_Frequency : 0x%x\n", ecs_test_msg[8]); - printf("RX_Frequency : 0x%x\n", ecs_test_msg[9]); - printf("Power_Control_Mode : 0x%x\n", ecs_test_msg[10]); - printf("Poll_Period : 0x%x\n", ecs_test_msg[11]); - printf("Test_Packet_Type : 0x%x\n", ecs_test_msg[12]); - printf("Length_Of_Test_Data : 0x%x\n", tmp[8]); + case HW_NO_INIT: + no_init_hw(bt_cfd, phys_fd, spd); + break; =20 - bt_send_raw_hci(bt_cfd, test_msg, 16); + case HW_UNKNOWN: + default: + unknown_init_hw(bt_cfd, phys_fd, spd); + break; + } } =20 -void -ericsson_enter_test_mode(int bt_cfd, int* tmp) +int +hw_vendor(void) { - unsigned char ecs_test_msg[7]; + static int hw_vendor =3D HW_NOT_PROBED; =20 - ecs_test_msg[0] =3D CMD_PKT; - ecs_test_msg[1] =3D OPCODE_LSB(ERICSSON_ENTER_TEST_MODE, MANUFACTURER_SP= EC); - ecs_test_msg[2] =3D OPCODE_MSB(ERICSSON_ENTER_TEST_MODE, MANUFACTURER_SP= EC); - ecs_test_msg[3] =3D 2; - ecs_test_msg[5]=3D (unsigned char)(tmp[0] & 0xff);=20=20=20=20 - ecs_test_msg[6]=3D (unsigned char)((tmp[0] >> 8)&0xff); + if (hw_vendor =3D=3D HW_NOT_PROBED) + { + char *vendor =3D bt_hw_vendor(); =20 - printf("*** Sending enter test mode (handle : 0x%x)***\n", tmp[0]); + if (!vendor) + hw_vendor =3D HW_UNKNOWN; + else if (!strcmp(vendor, "Ericsson")) + hw_vendor =3D HW_ERICSSON; + else if (!strcmp(vendor, "CSR")) + hw_vendor =3D HW_CSR; + else if (!strcmp(vendor, "Digianswer")) + hw_vendor =3D HW_DIGIANSWER; + else if (!strcmp(vendor, "USB")) + hw_vendor =3D HW_USB; + else if (!strcmp(vendor, "Generic")) + hw_vendor =3D HW_GENERIC; + else if (!strcmp(vendor, "No Init")) + hw_vendor =3D HW_NO_INIT; + else + hw_vendor =3D HW_UNKNOWN; + } =20 - bt_send_raw_hci(bt_cfd, ecs_test_msg, 7); + return hw_vendor; } =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=3D*/ +/* Ericsson specific commands */ +/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ + +/* Set the phys device to Ericsson default speed, 57600 */ void -test_connection_req(int bt_cfd, int* bd) +ericsson_init_phys(int fd) { - int hdl, i; - bt_connection btcon; + fd_setup(fd, 57600, USE_FLOW_CTRL); +} =20=20=20=20=20 - for (i =3D 0; i < 6; i++) +void +ericsson_init_hw(int bt_cfd, int phys_fd, int spd) { - btcon.bd[i] =3D (unsigned char)bd[i]; - } + bt_write_scan_enable(bt_cfd, 0 /* inpars not used */); =20=20=20 - printf("*** Connecting baseband ***\n"); + sleep(1); =20=20=20 -#ifndef BT_USERSTACK - if ((hdl =3D ioctl(bt_cfd, HCITESTCONNECTREQ, btcon.bd)) < 0) - { - perror("test con req"); + /* set_event_filter must be called for m/s switch on IrmaC! */ + bt_set_event_filter(bt_cfd, 0 /* inpars not used */); + + sleep(1); // wait for HW... + + printf("Setting baudrate in Ericsson module!\n");=20=20 + bt_set_baudrate(bt_cfd, spd); +=20=20 + /* Now set phys device speed to whatever HW was set to use */ + fd_setup(phys_fd, spd, USE_FLOW_CTRL); + tcflush(phys_fd, TCIOFLUSH); } -#else - hdl =3D hci_test_connect_req(btcon.bd); -#endif =20=20=20 - printf("Returned handle : %d\n", hdl); +/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ +/* CSR specific commands */ +/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ + +/* Set the phys device to CSR default, 115200 */=20 +void +csr_init_phys(int fd) +{ + syslog(LOG_INFO, "Setting default speed 115200"); + fd_setup(fd, 115200, USE_FLOW_CTRL); } =20 +/* fixme -- remove hardcoded values */ void -ericsson_tx_test(int bt_cfd, int* tmp) +csr_init_hw(int bt_cfd, int phys_fd, int spd) { - unsigned char ecs_test_msg[17]; - unsigned char test_msg[17]; - int i; + unsigned int wrscan =3D (PAGE_SCAN_ENABLE | INQUIRY_SCAN_ENABLE); =20=20=20 - ecs_test_msg[0] =3D CMD_PKT; - ecs_test_msg[1] =3D OPCODE_LSB(ERICSSON_TX_TEST, MANUFACTURER_SPEC); - ecs_test_msg[2] =3D OPCODE_MSB(ERICSSON_TX_TEST, MANUFACTURER_SPEC); - ecs_test_msg[3] =3D 13; + printf("Setting write_scan_enable in CSR module!\n"); =20=20=20=20=20 - /* cast ints to to uchars */ - for (i =3D 4; i < 14; i++) - { - ecs_test_msg[i] =3D (unsigned char)tmp[i-4]; - } + bt_write_scan_enable(bt_cfd, wrscan); =20=20=20 - /* length of test data */ - ecs_test_msg[15] =3D (unsigned char)(tmp[10] & 0xff);=20=20=20=20 - ecs_test_msg[16] =3D (unsigned char)((tmp[10] >> 8)&0xff); + /* improves reliability when doing a connect */ + printf("Setting write_pagescan_activity in CSR module!\n"); =20=20=20 - printf("*** Sending Ericsson_TX_Test ***\n"); + bt_write_pagescan_activity(bt_cfd, 0x50, 0x20); =20=20=20 - printf("RX_On_Start : 0x%x\n", ecs_test_msg[4]); - printf("Synt_On_Start : 0x%x\n", ecs_test_msg[5]); - printf("TX_On_Start : 0x%x\n", ecs_test_msg[6]); - printf("Phd_Off_Start : 0x%x\n", ecs_test_msg[7]); - printf("Test_Scenario : 0x%x\n", ecs_test_msg[8]); - printf("Hopping_Mode : 0x%x\n", ecs_test_msg[9]); - printf("TX_Frequency : 0x%x\n", ecs_test_msg[10]); - printf("RX_Frequency : 0x%x\n", ecs_test_msg[11]); - printf("TX_Test_Interval : 0x%x\n", ecs_test_msg[12] ); - printf("Test_Packet_Type : 0x%x\n", ecs_test_msg[13]); - printf("Length_Of_Test_Data : 0x%x\n", tmp[10]); + sleep(1); =20=20=20 - bt_send_raw_hci(bt_cfd, test_msg, 17); + bt_set_event_filter(bt_cfd, 0 /* inpars not used */); =20 - printf("TX test starting.\n"); -} + syslog(LOG_INFO, "Setting baudrate in CSR module!\n");=20=20 =20 -#endif /* ECS_TEST_FUNCTIONS */ + bt_set_baudrate(bt_cfd, spd); =20 -#elif HW_USED(HW_DIGIANSWER) + syslog(LOG_INFO, "Baudrate set\n"); =20 + /* Now set phys device speed to whatever HW was set to use */ + fd_setup(phys_fd, spd, USE_FLOW_CTRL); + tcflush(phys_fd, TCIOFLUSH); +} + /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ /* Digianswer specific commands */ /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ =20 /* Set the phys device to Digianswer default, 9600 */=20 -void init_phys(int fd) +void +digianswer_init_phys(int fd) { fd_setup(fd, 9600, USE_FLOW_CTRL); } =20=20 -init_hw(int bt_cfd, int phys_fd, int spd) +void +digianswer_init_hw(int bt_cfd, int phys_fd, int spd) { printf("Setting baudrate in Digianswer PC card\n"); =20 - bt_set_baudrate(spd); + bt_set_baudrate(bt_cfd, spd); =20=20=20 if (spd > 115200) { @@ -247,101 +282,76 @@ tcflush(phys_fd, TCIOFLUSH); } =20 -#elif HW_USED(HW_CSR) /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ -/* CSR specific commands */ +/* USB specific commands */ /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ =20 -/* Set the phys device to CSR default, 115200 */=20 -void init_phys(int fd) +void +usb_init_phys(int fd) { - syslog(LOG_INFO, "Setting default speed 115200"); fd_setup(fd, 115200, USE_FLOW_CTRL); } =20 -/* fixme -- remove hardcoded values */ void -init_hw(int bt_cfd, int phys_fd, int spd) +usb_init_hw(int bt_cfd, int phys_fd, int spd) { unsigned int wrscan =3D (PAGE_SCAN_ENABLE | INQUIRY_SCAN_ENABLE); =20 - printf("Setting write_scan_enable in CSR module!\n"); + printf("Setting write_scan_enable in USB module!\n"); =20 bt_write_scan_enable(bt_cfd, wrscan); -=20=20 - /* improves reliability when doing a connect */ - printf("Setting write_pagescan_activity in CSR module!\n"); - - bt_write_pagescan_activity(bt_cfd, 0x50, 0x20); - - sleep(1); - bt_set_event_filter(bt_cfd, 0 /* inpars not used */); - - syslog(LOG_INFO, "Setting baudrate in CSR module!\n");=20=20 - - bt_set_baudrate(bt_cfd, spd); - - syslog(LOG_INFO, "Baudrate set\n"); -=20=20 - /* Now set phys device speed to whatever HW was set to use */ - fd_setup(phys_fd, spd, USE_FLOW_CTRL); - tcflush(phys_fd, TCIOFLUSH); } =20 -#elif HW_USED(HW_GENERIC) /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ -/* Generic specific commands */ +/* Generic commands */ /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ =20 -void init_phys(int fd) +void +generic_init_phys(int fd) { fd_setup(fd, 115200, USE_FLOW_CTRL); } =20 void -init_hw(int bt_cfd, int phys_fd, int spd) +generic_init_hw(int bt_cfd, int phys_fd, int spd) { unsigned int wrscan =3D (PAGE_SCAN_ENABLE | INQUIRY_SCAN_ENABLE); =20 - printf("Setting write_scan_enable in USB module!\n"); + printf("Setting write_scan_enable in generic module!\n"); =20=20=20 bt_write_scan_enable(bt_cfd, wrscan); bt_set_event_filter(bt_cfd, 0 /* inpars not used */); - } =20 -#elif HW_USED(HW_NOINIT) /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ -/* HW No init commands */ +/* No HW init commands */ /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ =20 -void init_phys(int fd) +void +no_init_phys(int fd) { - printf("init_phys: No hardware.\n"); } =20 void -init_hw(int bt_cfd, int phys_fd, int spd) +no_init_hw(int bt_cfd, int phys_fd, int spd) { - printf("No hw init done\n"); } =20 -#else /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ /* Default */ /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ =20 -void init_phys(int fd) +void +unknown_init_phys(int fd) { printf("ERROR: init_phys() not implemented!\n"); } =20 -init_hw(int bt_cfd, int phys_fd, int spd) +void +unknown_init_hw(int bt_cfd, int phys_fd, int spd) { printf("ERROR: init_hw() not implemented!\n"); } - -#endif /* HW_USED() */ =20 /*********************************************************************/ --- bt_vendor.h 2001/03/02 10:59:57 1.1 +++ bt_vendor.h 2001/04/20 16:11:35 1.2 @@ -57,11 +57,4 @@ void init_hw(int bt_cfd, int phys_fd, int spd); void init_phys(int fd); =20 -#if HW_USED(HW_ERICSSON) -void enable_dut(int bt_cfd); -void test_connection_req(int bt_cfd, int* bd); -void ericsson_test_control(int bt_cfd, int* tmp); -void ericsson_enter_test_mode(int bt_cfd, int* tmp); -void ericsson_tx_test(int bt_cfd, int* tmp); -#endif #endif /* __BT_VENDOR_H__*/ |
From: Peter K. <pk...@us...> - 2001-04-20 15:29:22
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- bt_if.c 1.9 1.10=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 The accompanying log: * Added BTHWVENDOR ioctl and bt_hw_vendor() to retrieve the harware vendor. * Some clean-up. The diff of the modified file(s): --- bt_if.c 2001/04/18 14:01:34 1.9 +++ bt_if.c 2001/04/20 15:29:21 1.10 @@ -78,7 +78,7 @@ =20=20=20 if (ioctl(bt_cfd, BTINITSTACK)<0) { - perror("Init stack"); + perror(__FUNCTION__); exit(1); } #endif @@ -100,9 +100,9 @@ int bt_cfd =3D open(BT_CTRL_TTY, O_RDWR | O_NOCTTY); int stack_initiated =3D -1; =20 - if (ioctl(bt_cfd, BTISINITIATED, &stack_initiated) < 0) + if (bt_cfd < 0 || ioctl(bt_cfd, BTISINITIATED, &stack_initiated) < 0) { - perror("bt_isinitiated"); + perror(__FUNCTION__); exit(1); } close(bt_cfd); @@ -131,6 +131,22 @@ #endif } =20 +#ifndef BT_USERSTACK +char* bt_hw_vendor(void) +{ + int bt_cfd =3D open(BT_CTRL_TTY, O_RDWR | O_NOCTTY); + static char buffer[20]; + + if (bt_cfd < 0 || ioctl(bt_cfd, BTHWVENDOR, buffer) < 0) + { + perror(__FUNCTION__); + return NULL; + } + close(bt_cfd); + return buffer; +} +#endif + void reset_hw(void) { #ifdef __CRIS__ @@ -141,7 +157,7 @@ { if (ioctl(devfd, BTRESETPHYSICALHW) < 0) { - perror("Resetting hardware"); + perror(__FUNCTION__); exit(1); } sleep(2); @@ -152,7 +168,7 @@ } else { - printf("ERROR! Failed to open " BT_CTRL_TTY "\n"); + fprintf(stderr, "ERROR! Failed to open " BT_CTRL_TTY "\n"); } #else printf("Please reset HW board within 5 seconds\n"); @@ -165,12 +181,12 @@ int bt_cfd; printf("Now opening BT Ctrl TTY [%s]\n", BT_CTRL_TTY); #ifdef BT_USERSTACK - printf("bt_openctrl : ignored in userstack\n"); + printf(__FUNCTION__ ": ignored in userstack\n"); return FD_BTUSERCTRL; #else=20 if ((bt_cfd =3D open(BT_CTRL_TTY, O_RDWR | O_NOCTTY)) < 0) { - printf("could not open %s\n", BT_CTRL_TTY); + fprintf(stderr, "could not open %s\n", BT_CTRL_TTY); exit(1); } #endif @@ -209,7 +225,8 @@ srv_ch =3D GET_RFCOMMSRVCH(con_id); line =3D GET_RFCOMMLINE(con_id); =20=20 - if (line !=3D 0) { + if (line !=3D 0) + { printf("Use line 0 instead ! (usermode only)\n"); return -1; } @@ -238,7 +255,8 @@ CHECK_RFCOMM(con_id); line =3D GET_RFCOMMLINE(con_id); =20=20=20 - if (line !=3D 0) { + if (line !=3D 0) + { printf("Use line 0 instead ! (usermode only)\n"); return -1; } @@ -256,11 +274,11 @@ #ifndef BT_USERSTACK if ((ret =3D ioctl(bt_fd, BTISLOWERCONNECTED, &line)) < 0) { - perror("bt_isconnected"); + perror(__FUNCTION__); exit(1); } #else - printf("bt_isconnected NOT IMPL FOR USERMODE STACK !!\n"); + fprintf(stderr, __FUNCTION__ ": not yet implemented...\n"); ret =3D -1; #endif return ret; @@ -274,10 +292,10 @@ =20 len =3D bt_read_internal(tmp); tmp[len] =3D 0; - printf("%s", tmp); + printf(tmp); #else /*FIXME -- read /proc/bt_internal and print it on the console */ - printf("not yet...\n"); + fprintf(stderr, __FUNCTION__ ": not yet implemented...\n"); #endif=20 } =20 @@ -299,7 +317,7 @@ len =3D MAXSIZE; } =20=20=20 - printf("bt_send %d X %d bytes [%d k]\n", len, repeat, len*repeat/1000);= =20 + printf(__FUNCTION__ ": %d X %d bytes [%d k]\n", len, repeat, len*repeat/= 1000);=20 =20=20=20 /* fill them with letters... */ for (j =3D 0; j < len; j++) @@ -348,32 +366,30 @@ #ifndef BT_USERSTACK if (ioctl(bt_fd, BTWAITFORCONNECTION, &line) < 0) { - perror("bt_waitline"); + perror(__FUNCTION__); exit(1); } - printf("bt_waitline : got a connection !\n"); + printf(__FUNCTION__ ": got a connection !\n"); #else /* fixme<1> */ - printf("bt_waitline : not impl in usermode stack\n"); + fprintf(stderr, __FUNCTION__ ": not yet implemented...\n"); #endif } =20 void bt_waitnewconnections(int bt_fd) { - syslog(LOG_INFO, "bt_waitnewconnections\n"); + printf("Wait for a new connection\n"); #ifndef BT_USERSTACK if (ioctl(bt_fd, BTWAITNEWCONNECTIONS) < 0) { - perror("bt_waitnewconnections"); + perror(__FUNCTION__); exit(1); } - printf("bt_waitnewconnections : found a connection !\n"); - return; + printf(__FUNCTION__ ": found a connection !\n"); #else /* fixme<1>*/ - printf("bt_waitnewconnections : not impl in usermode stack\n"); - return; + fprintf(stderr, __FUNCTION__ ": not yet implemented...\n"); #endif } =20=20 @@ -384,13 +400,13 @@ #ifndef BT_USERSTACK if (ioctl(bt_fd, BTWAITFORCONNECTION, &line) < 0) { - perror("bt_waitconnection"); + perror(__FUNCTION__); exit(1); } - printf("bt_waitconnection : got a connection !\n"); + printf(__FUNCTION__ ": got a connection !\n"); #else /* fixme<1>*/ - printf("bt_waitconnection : not impl in usermode stack\n"); + fprintf(stderr, __FUNCTION__ ": not yet implemented...\n"); #endif } =20 @@ -407,10 +423,10 @@ #ifndef BT_USERSTACK=20 if (ioctl(bt_cfd, HCISENDRAWDATA, buf) < 0) { - perror("bt_send_raw_hci"); + perror(__FUNCTION__); } #else - printf("not yet for usermode stack...\n"); + fprintf(stderr, __FUNCTION__ ": not yet implemented...\n"); //hci_send_raw_data(data, 16); #endif return 0; @@ -422,7 +438,7 @@ int ret_val; struct ping_struct ping; =20=20=20 - print_data("bt_ping BD : ", bd, 6); + print_data(__FUNCTION__ " BD : ", bd, 6); memcpy(ping.bd, bd, 6); ping.len =3D len;=20=20 memcpy(ping.data, data, len); @@ -465,9 +481,9 @@ =20 int bt_testcmd(int bt_cfd, unsigned char *cmd) { - int ret_val; + int ret_val =3D 0; =20=20=20 - printf("bt_testcmd\n"); + printf(__FUNCTION__ "\n"); print_data("cmd ", cmd, strlen(cmd)); =20 #ifndef BT_USERSTACK=20 @@ -478,7 +494,7 @@ else printf("Success!\n"); #else - printf("bt_testcmd mpt for usermode stack yet\n"); + fprintf(stderr, __FUNCTION__ ": not yet implemented...\n"); #endif return ret_val; } @@ -487,11 +503,11 @@ { int ret_val; =20 - syslog(LOG_INFO, "bt_force_msswitch_as_server: %d\n", enable); + syslog(LOG_INFO, __FUNCTION__ ": %d", enable); #ifndef BT_USERSTACK=20 if ((ret_val =3D ioctl(bt_cfd, BTSETMSSWITCH, &enable)) !=3D 0) { - printf("Error : %s\n", error_msg(ret_val)); + fprintf(stderr, __FUNCTION__ ": %s\n", error_msg(ret_val)); } #else hci_force_msswitch(enable); @@ -499,7 +515,6 @@ return ret_val; } =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 */ /* HCI functions */ =20 @@ -527,7 +542,7 @@ =20 if (ioctl(bt_cfd, HCIINQUIRY, inq_res) < 0) { - perror("Inquiry"); + perror(__FUNCTION__); exit(1); } =20 @@ -551,7 +566,7 @@ #ifndef BT_USERSTACK if (ioctl(bt_cfd, HCIWRITEBDADDR, bd) < 0) { - perror("Set bd addr"); + perror(__FUNCTION__); } #else hci_set_bd_addr(bd); @@ -566,7 +581,7 @@ { int result; =20 - syslog(LOG_INFO, "bt_set_baudrate %d baud", spd); + syslog(LOG_INFO, __FUNCTION__ ": %d baud", spd); #ifdef BT_USERSTACK tcflush(phys_fd, TCIOFLUSH); result =3D hci_set_baudrate(spd); @@ -574,7 +589,7 @@ #else if ((result =3D ioctl(bt_cfd, HCISETBAUDRATE, &spd)) < 0) { - perror("HCISETBAUDRATE"); + perror(__FUNCTION__); exit(1); } #endif @@ -587,7 +602,7 @@ #ifndef BT_USERSTACK if (ioctl(bt_cfd, HCIREADLOCALBDADDR, bd_addr) < 0) { - perror("Read bd addr"); + perror(__FUNCTION__); } #else int i; @@ -610,7 +625,7 @@ #ifndef BT_USERSTACK if (ioctl(bt_cfd, HCIENABLEDUT) < 0) { - perror("enable_dut"); + perror(__FUNCTION__); } #else hci_enable_dut(); @@ -626,7 +641,7 @@ #ifndef BT_USERSTACK if (ioctl(bt_cfd, BTREADREMOTEBDADDR, bd_addr) < 0) { - perror("Read client bd addr"); + perror(__FUNCTION__); } #else BD_ADDR rev_bd; @@ -647,7 +662,7 @@ unsigned int wrscan =3D (PAGE_SCAN_ENABLE | INQUIRY_SCAN_ENABLE); int result; =20=20=20 - syslog(LOG_INFO, "Setting write_scan_enable [0x%x]\n", wrscan); + syslog(LOG_INFO, "Setting write_scan_enable [0x%x]", wrscan); =20 #ifdef BT_USERSTACK result =3D hci_write_scan_enable(wrscan); @@ -655,7 +670,7 @@ =20 if ((result =3D ioctl(bt_cfd, HCIWRITESCANENABLE, &wrscan)) < 0) {=20 - perror("bt_set_writescanenable"); + perror(__FUNCTION__); exit(1); } #endif=09 @@ -667,10 +682,9 @@ unsigned int wind) { /* improves reliability when doing a connect */ - syslog(LOG_INFO, "Setting write_pagescan_activity in CSR module!\n"); + syslog(LOG_INFO, "Setting write_pagescan_activity in CSR module!"); =20 #ifdef BT_USERSTACK - hci_write_pagescan_activity(interval, wind); #else { @@ -681,7 +695,7 @@ =20 if (ioctl(bt_cfd, HCIWRITEPAGESCANACTIVITY, &tmp) < 0) {=20 - perror("bt_write_pagescan_activity"); + perror(__FUNCTION__); exit(1); } } @@ -707,7 +721,7 @@ =20 if ((result =3D ioctl(bt_cfd, HCISET_EVENT_FILTER, &evfilter)) < 0) {=20 - perror("HCISET_EVENT_FILTER"); + perror(__FUNCTION__); exit(1); } #endif @@ -732,7 +746,7 @@ #ifndef BT_USERSTACK=20 if (ioctl(bt_cfd, HCIWRITECLASSOFDEVICE, class_of_device) < 0) { - perror("bt_set_classofdevice"); + perror(__FUNCTION__); exit(1); } #else @@ -741,16 +755,15 @@ break; =20 case 1: - syslog(LOG_INFO, "bt_set_classofdevice, Unsupported format 0x%02x\n",= =20 - format); + syslog(LOG_INFO, __FUNCTION__ ": Unsupported format 0x%02x\n", format); break; =20 case 2: - syslog(LOG_INFO, "bt_set_classofdevice, Unsupported format 0x%02x\n", = format); + syslog(LOG_INFO, __FUNCTION__ ": Unsupported format 0x%02x\n", format); break; =20 default: - syslog(LOG_INFO, "bt_set_classofdevice, Unsupported format 0x%02x\n", = format); + syslog(LOG_INFO, __FUNCTION__ ": Unsupported format 0x%02x\n", format); break; } } @@ -775,7 +788,7 @@ #ifndef BT_USERSTACK if (ioctl(bt_cfd, HCISWITCHROLE, tmp) < 0) { - perror("role_switch"); + perror(__FUNCTION__); } #else hci_switch_role(bd_addr, role); @@ -788,14 +801,14 @@ #ifndef BT_USERSTACK if (ioctl(phys_fd, TIOCSETD, &bt_disc) < 0) { - perror("Set bt line disc"); + perror(__FUNCTION__); syslog(LOG_INFO, "Forgot to insmod bt.o ? [bt_disc %d]\n", bt_disc); exit(1); } syslog(LOG_INFO, "Registered bluetooth line discipline on %s\n", physdev= ); printf("Registered bluetooth line discipline on %s\n", physdev); #else - printf("set_bt_line_disc, ignored in usermode stack\n"); + fprintf(stderr, __FUNCTION__ ": ignored in usermode stack\n"); #endif } =20 @@ -847,7 +860,7 @@ #ifndef BT_USERSTACK=20=20 if (ioctl(bt_cfd, HCISETLOCALNAME, buf) < 0) { - perror("HCI set local name");=20 + perror(__FUNCTION__); exit(1); } #else @@ -992,7 +1005,7 @@ syslog(LOG_INFO, "Opening dev %s\n", dev); if ((fd =3D open(dev, flags | O_NOCTTY)) < 0) { - perror("open_device"); + perror(__FUNCTION__); exit(1); } =20=20=20 @@ -1002,7 +1015,7 @@ =20 void close_device(int fd) { - syslog(LOG_INFO, "close_device"); + syslog(LOG_INFO, __FUNCTION__); =20=20=20 #ifdef BT_USERSTACK /* if fake fd is used, ignore close since there are no open fd */ @@ -1071,7 +1084,7 @@ { printf("Initiating read thread\n"); if (pthread_create(&read_thread, NULL, (void*)hci_receive_thread, NULL) = !=3D 0) - perror("pthread_create");=20=20=20=20 + perror(__FUNCTION__); sleep(1); /* wait for thread to start */ return 0; } @@ -1105,7 +1118,7 @@ void init_upper_pty(void) { - printf("init_upper_pty"); + printf(__FUNCTION__); // open_pty(); // init_pty_thread();=20=20 } @@ -1208,8 +1221,7 @@ =20=20=20 if ((n =3D write(pty_master_fd, data, len)) !=3D len) { - BT_DATA("bt_receive_top: tried to write %d bytes, wrote %d\n", - len, n); + BT_DATA(__FUNCTION__ ": tried to write %d bytes, wrote %d\n", len, n); } #endif =20 @@ -1222,10 +1234,10 @@ bt_connect_ind(unsigned int con_id)=20 { if (GET_PSM(con_id) =3D=3D RFCOMM_LAYER) - printf("bt_connect_ind : RFCOMM dlci : %d\n",=20 + printf(__FUNCTION__ ": RFCOMM dlci : %d\n",=20 GET_RFCOMMDLCI(con_id)); else - printf("bt_connect_ind : psm %d\n", GET_PSM(con_id)); + printf(__FUNCTION__ ": psm %d\n", GET_PSM(con_id)); } =20 void @@ -1242,29 +1254,29 @@ =20 if ((line < 0) || (line > BT_NBR_DATAPORTS)) { =20 - printf("bt_connect_cfm on invalid line (%d)\n", line); + fprintf(stderr, __FUNCTION__ ": invalid line (%d)\n", line); return; } - printf("bt_connect_cfm : failed, status %d [%s] line %d\n", status, ps= mname(psm), line); + fprintf(stderr, __FUNCTION__": failed, status %d [%s] line %d\n", stat= us, psmname(psm), line); =20 return; } =20 switch (psm) { case RFCOMM_LAYER: - printf("bt_connect_cfm [%s]\n", psmname(psm)); + printf(__FUNCTION__ ": [%s]\n", psmname(psm)); break; =20 case SDP_LAYER: - printf("bt_connect_cfm [%s]\n", psmname(psm)); + printf(__FUNCTION__ ": [%s]\n", psmname(psm)); break; =20 case TCS_LAYER: - printf("bt_connect_cfm [%s]\n", psmname(psm)); + printf(__FUNCTION__ ": [%s]\n", psmname(psm)); break; =20 default: - printf("bt_connect_cfm : unknown layer %d\n", psm); + printf(__FUNCTION__ ": unknown layer %d\n", psm); break; } } @@ -1273,15 +1285,15 @@ bt_disconnect_ind(unsigned int con_id)=20 { if (GET_PSM(con_id) =3D=3D RFCOMM_LAYER) - printf("bt_disconnect_ind : RFCOMM dlci : %d\n", GET_RFCOMMDLCI(con_id= )); + printf(__FUNCTION__ ": RFCOMM dlci : %d\n", GET_RFCOMMDLCI(con_id)); else - printf("bt_disconnect_ind : psm %d\n", GET_PSM(con_id)); + printf(__FUNCTION__ ": psm %d\n", GET_PSM(con_id)); } =20 int bt_register_rfcomm(struct rfcomm_con *rfcomm, u8 dlci) { - printf("bt_register_rfcomm on dlci %d\n", dlci); + printf(__FUNCTION__ ": dlci %d\n", dlci); test_rfcomm =3D rfcomm; test_dlci =3D dlci; return 0; @@ -1290,20 +1302,20 @@ s32 bt_unregister_rfcomm(s32 line) { - printf("bt_unregister_rfcomm on line %d\n", line); + printf(__FUNCTION__ ": line %d\n", line); /* fixme -- stub for now */ } =20 s32 bt_register_sdp(u8 line, u8 sdpID) { - printf("bt_register_sdp\n"); + printf(__FUNCTION__ "\n"); return 0; } =20 s32 bt_unregister_sdp(s32 line) { - printf("bt_unregister_sdp\n"); + printf(__FUNCTION__ "\n"); return 0; } =20 --- bt_if.h 2001/03/30 12:32:47 1.4 +++ bt_if.h 2001/04/20 15:29:21 1.5 @@ -41,7 +41,7 @@ =20=20 =20 #ifndef __BT_IF_H__ -#define __BT_IP_H__ +#define __BT_IF_H__ =20 #include "btd.h" #ifdef BT_USERSTACK @@ -61,10 +61,10 @@ #ifndef N_BT #define N_BT 15 #endif + #define HOST_NAME_LENGTH 100 #define DOMAIN_NAME_LENGTH 100 =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 */ /* BT defines */ =20 @@ -112,7 +112,6 @@ #define L2CAP_FAILED 0xf0 #define L2CAP_CON_UNRESPONSIVE 0xf1 =20 - #ifndef BT_USERSTACK =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 */ @@ -148,6 +147,7 @@ #define BTREADREMOTEBDADDR _IOR(BT_IOC_MAGIC, 0x07, unsigned char[6]) #define BTRESETPHYSICALHW _IO(BT_IOC_MAGIC, 0x08) #define BTISINITIATED _IOR(BT_IOC_MAGIC, 0x09, int) +#define BTHWVENDOR _IOR(BT_IOC_MAGIC, 0x0A, char[20]) =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 */ /* Ioctls for executing HCI commands */ @@ -166,7 +166,6 @@ =20 #define HCISWITCHROLE _IOW(BT_IOC_MAGIC, 0x20, unsigned char[7]) =20 - /* Host Controller & Baseband Commands */ =20 #define HCIRESET _IO(BT_IOC_MAGIC, 0x30) @@ -186,19 +185,16 @@ #define HCIWRITE_ENCRYPTION_MODE _IOWR(BT_IOC_MAGIC, 0x3e, int) #define HCISET_EVENT_FILTER _IOW(BT_IOC_MAGIC, 0x3f, unsigned char[3]) =20 - /* Informational Parameters */ =20 #define HCIREADLOCALBDADDR _IOR(BT_IOC_MAGIC, 0x45, unsigned char[6]) =20 - /* Status Parameters */ =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 */ /* Testing Commands */ #define HCIENABLEDUT _IO(BT_IOC_MAGIC, 0x65) =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 */ /* Ioctls Vendor specific HCI commands */ =20 @@ -243,12 +239,14 @@ /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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_connection{ +typedef struct bt_connection +{ unsigned char bd[6]; unsigned int id; /* | psm(16 bits)=A0| layer_specific (16 bits)=A0|=A0*/ } bt_connection; =20 -typedef struct inquiry_results { +typedef struct inquiry_results +{ unsigned int nbr_of_units; unsigned int inq_time; unsigned char bd_addr[0]; @@ -262,6 +260,7 @@ } 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 @@ -272,8 +271,11 @@ void init_stack(int bt_cfd, int spd); int bt_isinitiated(void); void shutdown_stack(int bt_cfd); -int bt_openctrl(void); +#ifndef BT_USERSTACK +char* bt_hw_vendor(void); +#endif void reset_hw(void); +int bt_openctrl(void); void set_bt_line_disc(int phys_fd, int bt_disc, char* physdev); =20 /*=20 @@ -333,10 +335,6 @@ const char *error_msg(int err); int start_sdp_server(void); =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 */ =20 @@ -369,4 +367,4 @@ =20 #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_IP_H__*/ +#endif /* __BT_IF_H__ */ |
From: Peter K. <pk...@us...> - 2001-04-20 14:33:37
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.170 1.171=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Added ioctl (BTHWVENDOR) to retrieve the vendor of the hardware. The diff of the modified file(s): --- bluetooth.c 2001/04/19 00:22:11 1.170 +++ bluetooth.c 2001/04/20 14:33:07 1.171 @@ -688,6 +688,10 @@ put_user(bt_stack_initiated, (s32*)arg); break; =20 + case BTHWVENDOR: + copy_to_user((u8*)arg, bt_hw_vendor(), strlen(bt_hw_vendor())+1); + break; + case BTSENDTESTDATA: copy_from_user(&tmp, (s32*)arg, 4); copy_from_user(&utmp, (s32*)arg + 1, 4); |
From: Peter K. <pk...@us...> - 2001-04-20 14:33:08
|
The following file was modified in linux/include/linux/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- btcommon.h 1.71 1.72=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Added ioctl (BTHWVENDOR) to retrieve the vendor of the hardware. The diff of the modified file(s): --- btcommon.h 2001/04/17 16:06:49 1.71 +++ btcommon.h 2001/04/20 14:33:07 1.72 @@ -126,6 +126,7 @@ #define BTREADREMOTEBDADDR _IOR(BT_IOC_MAGIC, 0x07, u8[6]) #define BTRESETPHYSICALHW _IO(BT_IOC_MAGIC, 0x08) #define BTISINITIATED _IOR(BT_IOC_MAGIC, 0x09, s32) +#define BTHWVENDOR _IOR(BT_IOC_MAGIC, 0x0A, char[20]) =20 #define BTWAITFORCONNECTION _IOW(BT_IOC_MAGIC, 0x0a, s32) #define BTWAITNEWCONNECTIONS _IO(BT_IOC_MAGIC, 0x0b) |
From: Peter K. <pk...@us...> - 2001-04-20 11:45:06
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci_vendor.c 1.26 1.27=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Added commands for setting BD address and baud rate in CSR module, and for reading hardware/firmware information. The diff of the modified file(s): --- hci_vendor.c 2001/04/18 15:47:13 1.26 +++ hci_vendor.c 2001/04/20 11:45:05 1.27 @@ -412,31 +412,385 @@ =20 #define VENDOR " [CSR]" =20 +#define CSR_CH_ID_BCCMD 0x02 +#define CSR_CH_ID_HQ 0x03 + +#define CSR_MSGTYPE_GETREQ 0x0000 +#define CSR_MSGTYPE_GETRESP 0x0001 +#define CSR_MSGTYPE_SETREQ 0x0002 + +#define CSR_STATUS_OK 0x0000 +#define CSR_STATUS_NO_SUCH_VARID 0x0001 +#define CSR_STATUS_TOO_BIG 0x0002 +#define CSR_STATUS_NO_VALUE 0x0003 +#define CSR_STATUS_BAD_REQ 0x0004 +#define CSR_STATUS_NO_ACCESS 0x0005 +#define CSR_STATUS_READ_ONLY 0x0006 +#define CSR_STATUS_WRITE_ONLY 0x0007 +#define CSR_STATUS_ERROR 0x0008 +#define CSR_STATUS_PERMISSION_DENIED 0x0009 + +#define CSR_CMD_CONFIG_UART 0x6802 +#define CSR_CMD_BUILD_ID 0x2819 +#define CSR_CMD_CHIP_VER 0x281a +#define CSR_CMD_CHIP_REV 0x281b +#define CSR_CMD_PS 0x7003 + +#define CSR_PS_BDADDR 0x0001 +#define CSR_PS_BAUD_RATE 0x0204 + +#define CSR_UART_RATE_9K6 0x0027 +#define CSR_UART_RATE_19K2 0x004f +#define CSR_UART_RATE_38K4 0x009d +#define CSR_UART_RATE_57K6 0x00ec +#define CSR_UART_RATE_115K2 0x01d8 +#define CSR_UART_RATE_230K4 0x03b0 +#define CSR_UART_RATE_460K8 0x075f +#define CSR_UART_RATE_921K6 0x0ebf + +#define CSR_UART_ONE_STOP_BIT 0x0000 +#define CSR_UART_TWO_STOP_BITS 0x2000 + +#define CSR_UART_NO_PARITY 0x0000 +#define CSR_UART_ODD_PARITY 0x4000 +#define CSR_UART_EVEN_PARITY 0xc000 + +typedef struct payload_descr +{ + u8 ch_id:6; + u8 first:1; + u8 last:1; +} payload_descr; + +typedef struct csr_msg +{ + payload_descr p_descr; + u8 msg[0]; +} csr_msg; + +typedef struct csr_bccmd +{ + u16 type; + u16 len; /* in 16 bit integers */ + u16 seq; + u16 var_id; + u16 status; + u16 payload[0]; +} csr_bccmd; +=20=20 +typedef struct csr_bccmd_ps +{ + u16 ps_key; + u16 ps_len; /* len of only ps_val */ + u16 unused; /* always 0x0000 */ + u16 ps_val[0]; +} csr_bccmd_ps; + +static u16 csr_count =3D 0; + s32=20 hci_set_bd_addr(u8 bd[6]) { - D_ERR(__FUNCTION__ VENDOR " not supported.\n"); - return 0; + csr_msg *msg; + csr_bccmd *cmd; + csr_bccmd_ps *ps; + + D_CMD(__FUNCTION__ VENDOR "\n"); + + /* HCI Manufacturer specific header */ + c_pkt.type =3D CMD_PKT; + c_pkt.opcode =3D hci_put_opcode(0x00, 0x3f); + c_pkt.len =3D 1 + 5*sizeof(u16) + 3*sizeof(u16) + 4*sizeof(u16); + + msg =3D (csr_msg *)c_pkt.data; + cmd =3D (csr_bccmd *)msg->msg; + ps =3D (csr_bccmd_ps *)cmd->payload; + + /* General msg header */ + msg->p_descr.last =3D 1; /* first and last segment */ + msg->p_descr.first =3D 1; + msg->p_descr.ch_id =3D CSR_CH_ID_BCCMD; + + /* BCCMD type */ + cmd->type =3D CSR_MSGTYPE_SETREQ; + cmd->len =3D 5 + 3 + 4; + cmd->seq =3D csr_count++; + cmd->var_id =3D CSR_CMD_PS; + cmd->status =3D CSR_STATUS_OK; /* always OK in SETREQ */ + + /* Actual PS key request */ + ps->ps_key =3D CSR_PS_BDADDR; + ps->ps_len =3D 4; /* x 16 bits */ + ps->unused =3D 0x0000; + + ps->ps_val[0] =3D ((u16)bd[3]) & 0x00ff; + ps->ps_val[1] =3D ((((u16)bd[4]) << 8) | ((u16)bd[5])); + ps->ps_val[2] =3D (u16)bd[2]; + ps->ps_val[3] =3D (((u16)bd[0] << 8) | ((u16)bd[1])); + + return send_cmd_block((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN= ); } =20 s32 hci_read_firmware_rev_info(void) { - D_ERR(__FUNCTION__ VENDOR " not supported.\n"); - return 0; + s32 tmp; + csr_msg *msg; + csr_bccmd *cmd; + + D_CMD(__FUNCTION__ VENDOR "\n"); +=09 + /* HCI Manufacturer specific header */ + c_pkt.type =3D CMD_PKT; + c_pkt.opcode =3D hci_put_opcode(0x00, 0x3f); + c_pkt.len =3D 1 + 5*sizeof(u16) + 6*sizeof(u16); + + msg =3D (csr_msg *)c_pkt.data; + cmd =3D (csr_bccmd *)msg->msg; + + /* General msg header */ + msg->p_descr.last =3D 1; /* first and last segment */ + msg->p_descr.first =3D 1; + msg->p_descr.ch_id =3D CSR_CH_ID_BCCMD; + + /* BCCMD type */ + cmd->type =3D CSR_MSGTYPE_GETREQ; + cmd->len =3D 5 + 6; + cmd->seq =3D csr_count++; + cmd->var_id =3D CSR_CMD_BUILD_ID; + cmd->status =3D CSR_STATUS_OK; /* always OK in GETREQ */ + memset(cmd->payload, 0, 6*sizeof(u16)); + + tmp =3D send_cmd_block((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LE= N); + if (tmp < 0) + return tmp; + + cmd->seq =3D csr_count++; + cmd->var_id =3D CSR_CMD_CHIP_VER; + memset(cmd->payload, 0, 6*sizeof(u16)); + tmp =3D send_cmd_block((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LE= N); + if (tmp < 0) + return tmp; + + cmd->seq =3D csr_count++; + cmd->var_id =3D CSR_CMD_CHIP_REV; + memset(cmd->payload, 0, 6*sizeof(u16)); + tmp =3D send_cmd_block((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LE= N); + + return tmp; } =20 +//#define SET_BAUD_RATE_TEMPORARILY s32=20 hci_set_baudrate(u32 baudrate) { - D_ERR(__FUNCTION__ VENDOR " not supported.\n"); - return 0; + s32 tmp; + csr_msg *msg; + csr_bccmd *cmd; + csr_bccmd_ps *ps; + u16 baud_divider; + + D_CMD(__FUNCTION__ VENDOR " (%u baud)\n", baudrate); + + switch (baudrate) { + case 57600: + baud_divider =3D CSR_UART_RATE_57K6; + break; + case 115200: + baud_divider =3D CSR_UART_RATE_115K2; + break; + case 230400: + baud_divider =3D CSR_UART_RATE_230K4; + break; + case 460800: + baud_divider =3D CSR_UART_RATE_460K8; + break; + case 921600: + baud_divider =3D CSR_UART_RATE_921K6; + break; + default: + D_ERR(__FUNCTION__ VENDOR ": Baudrate %u not supported\n", baudrate); + return -EINVAL; + } + + /* HCI Manufacturer specific header */ + c_pkt.type =3D CMD_PKT; + c_pkt.opcode =3D hci_put_opcode(0x00, 0x3f); +#ifdef SET_BAUD_RATE_TEMPORARILY + c_pkt.len =3D 1 + 5*sizeof(u16) + 6*sizeof(u16); +#else + c_pkt.len =3D 1 + 5*sizeof(u16) + 3*sizeof(u16) + 1*sizeof(u16); +#endif + + msg =3D (csr_msg *)c_pkt.data; + cmd =3D (csr_bccmd *)msg->msg; + ps =3D (csr_bccmd_ps *)cmd->payload; + + /* General msg header */ + msg->p_descr.last =3D 1; /* first and last segment */ + msg->p_descr.first =3D 1; + msg->p_descr.ch_id =3D CSR_CH_ID_BCCMD; + +#ifdef SET_BAUD_RATE_TEMPORARILY + cmd->type =3D CSR_MSGTYPE_SETREQ; + cmd->len =3D 5 + 6; + cmd->seq =3D csr_count++; + cmd->var_id =3D CSR_CMD_CONFIG_UART; + cmd->status =3D CSR_STATUS_OK; /* always OK in SETREQ */ + + memset(cmd->payload, 0, 6*sizeof(u16)); + cmd->payload[0] =3D baud_divider | CSR_UART_NO_PARITY | CSR_UART_ONE_STOP= _BIT; + + tmp =3D send_cmd_block((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LE= N); +#else + cmd->type =3D CSR_MSGTYPE_SETREQ; + cmd->len =3D 5 + 3 + 1; + cmd->seq =3D csr_count++; + cmd->var_id =3D CSR_CMD_PS; + cmd->status =3D CSR_STATUS_OK; /* always OK in SETREQ */ + + /* Actual PS key request */ + ps->ps_key =3D CSR_PS_BAUD_RATE; + ps->ps_len =3D 1; /* x 16 bits */ + ps->unused =3D 0x0000; + + ps->ps_val[0] =3D baud_divider; + + tmp =3D send_cmd_block((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LE= N); +#endif + + return tmp; } =20 +//#define VERBOSE void process_vendor_event(u8 *buf, u32 len, u32 event_code) { + csr_msg *msg; + csr_bccmd *cmd; + csr_bccmd_ps *ps; + D_REC(__FUNCTION__ VENDOR "\n"); +=09 + /* FIXME -- is there only one cmd buffer available ? */ + hci_ctrl.hc_buf.cmd_num =3D 1;=20=20 + + release_cmd_timer(); + + msg =3D (struct csr_msg *)buf; + cmd =3D (struct csr_bccmd *)msg->msg; + ps =3D (struct csr_bccmd_ps *)cmd->payload; + + switch (msg->p_descr.ch_id) { + case CSR_CH_ID_BCCMD: + if (cmd->type =3D=3D CSR_MSGTYPE_GETRESP && + cmd->status =3D=3D CSR_STATUS_OK) { + switch (cmd->var_id) { + case CSR_CMD_CONFIG_UART: + break; + + case CSR_CMD_BUILD_ID: + /* Store this for later retrieval */ + sprintf(bt_hw_firmware_info, + "\n Firmware version: %d", + cmd->payload[0]); + break; + + case CSR_CMD_CHIP_VER: + break; + + case CSR_CMD_CHIP_REV: + break; + + case CSR_CMD_PS: + break; + + default: + break; + } + } + break; + + case CSR_CH_ID_HQ: + break; + + default: + break; + } + +#ifdef VERBOSE + printk("msg: last: %d, first: %d, chID: %d\n",=20 + msg->p_descr.last, msg->p_descr.first, msg->p_descr.ch_id); + + printk("cmd: type: 0x%04X, msg_len: %d, seq_nbr: %d, varid: 0x%04X, statu= s: 0x%04X\n", + cmd->type, cmd->len, cmd->seq, cmd->var_id, cmd->status); + + switch (msg->p_descr.ch_id) { + case CSR_CH_ID_BCCMD: + printk("BCCMD MSG\n"); + + switch (cmd->type) { + case CSR_MSGTYPE_GETREQ: + printk("GETREQ\n"); + break; + + case CSR_MSGTYPE_GETRESP: + printk("GETRESP\n"); + break; + + case CSR_MSGTYPE_SETREQ: + printk("SETREQ\n"); + break; + + default: + break; + } + + if (cmd->status =3D=3D CSR_STATUS_OK) + printk("Command successful\n"); + + if (cmd->type =3D=3D CSR_MSGTYPE_GETRESP && + cmd->status =3D=3D CSR_STATUS_OK) { + switch (cmd->var_id) { + case CSR_CMD_CONFIG_UART: + printk("UART config: 0x%04X\n", cmd->payload[0]); + break; + + case CSR_CMD_BUILD_ID: + printk("Firmware version: %d\n", cmd->payload[0]); + break; + + case CSR_CMD_CHIP_VER: + printk("Chip Version: %d\n", cmd->payload[0]); + break; + + case CSR_CMD_CHIP_REV: + printk("Chip Revision: %d\n", cmd->payload[0]); + break; + + case CSR_CMD_PS: + if (cmd->len > 2*5) + printk("ps: key 0x%x, len %d\n", ps->ps_key, ps->ps_len); + break; + + default: + break; + } + } + break; + + case CSR_CH_ID_HQ: + printk("HQ MSG\n"); + break; + + default: + printk("Unknown MSG type\n"); + break; + } +#endif /* VERBOSE */ + + /* FIXME -- if using raw interface we haven't slept */ + wake_up_interruptible(&hci_wq);=09 } =20 void |
From: Gordon M. <gm...@us...> - 2001-04-19 14:37:56
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- l2cap.c 1.101 1.102=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: --Checked in a temporary fix to the null pointer dereference in process_req= uest. Eric Muehlhausen pointed this bug out. Mattias Agren said he'd check = in a permanent fix when he brings in some other changes. The diff of the modified file(s): --- l2cap.c 2001/04/19 10:31:34 1.101 +++ l2cap.c 2001/04/19 14:37:33 1.102 @@ -952,6 +952,22 @@ print_data(__FUNCTION__ ": optional data : ",=20 cmdreject->data, rsp->len-2); =20 + /* Find connection -- note that I'm not sure this is the right thing + to do here. I just wanted to make sure we don't try to dereference + a null 'con' pointer like we used to do. Mattias Agren promised + to check in a real fix when he brings some other changes in. + --gmcnutt (4/19/01) + */ + if ((conrsp =3D (sig_conrsp *)rsp->data) =3D=3D NULL) { + D_ERR(__FUNCTION__ ": no response data\n"); + return; + } + + if ((con =3D get_lcon(conrsp->src_cid)) =3D=3D NULL) { + D_ERR(__FUNCTION__ ": no connection\n"); + return; + } + /* fixme -- set 'real' reason code */ con->c_status =3D CSTATUS_CMDREJECT; =20=09=09 |
From: Peter K. <pk...@us...> - 2001-04-19 10:32:05
|
The following files were modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- l2cap.c 1.100 1.101=20=20=20=20=20=20=20=20=20=20=20 l2cap_con.c 1.8 1.9=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * Renamed free_list() to free_con_list(). * Redefined FLAG_* defines to more sensible values. The diff of the modified file(s): --- l2cap.c 2001/04/18 14:25:30 1.100 +++ l2cap.c 2001/04/19 10:31:34 1.101 @@ -361,7 +361,7 @@ } #endif =20 - free_list(); + free_con_list(); remove_all_upper(); =20 #ifdef __CRIS__ --- l2cap_con.c 2001/04/19 10:29:14 1.8 +++ l2cap_con.c 2001/04/19 10:31:34 1.9 @@ -130,7 +130,7 @@ } =20 void=20 -free_list(void) +free_con_list(void) { D_CON(__FUNCTION__ ": Freeing connection list\n"); while (con_list.count) @@ -550,7 +550,7 @@ show_list(); remove_rcid(5); show_list(); - free_list(); + free_con_list(); show_list(); /* ... */ } |
From: Peter K. <pk...@us...> - 2001-04-19 10:31:35
|
The following file was modified in linux/include/linux/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- l2cap_con.h 1.5 1.6=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * Renamed free_list() to free_con_list(). * Redefined FLAG_* defines to more sensible values. The diff of the modified file(s): --- l2cap_con.h 2001/03/30 09:45:06 1.5 +++ l2cap_con.h 2001/04/19 10:31:34 1.6 @@ -60,11 +60,10 @@ /****************** TYPE DEFINITION SECTION ******************************= ***/ =20 /* con->c_flags */ -#define FLAG_WAKEMEUP 0x1 /* wake up con->wq */ -#define FLAG_RETURNNOW 2 /* return immediately, used when setting up=20 +#define FLAG_WAKEMEUP 0x0001 /* wake up con->wq */ +#define FLAG_RETURNNOW 0x0002 /* return immediately, used when setting up= =20 baseband */ -#define FLAG_DONTSLEEP (2<<2) /* used when e.g ertx_timeout calls disc req= */ -#define FLAG_SOMETHING (2<<3) /* ??? */ +#define FLAG_DONTSLEEP 0x0004 /* used when e.g ertx_timeout calls disc req= */ =20 /* con->c_status */ #define CSTATUS_SUCCESS 0 /* return status success to upper caller */ @@ -82,7 +81,7 @@ /*********************************************************************/ =20 void init_con_list(void); -void free_list(void); +void free_con_list(void); =20 l2cap_con* create_con(u16 hci_hdl, CID lcid, CID rcid); s32 delete_con(l2cap_con *con); |
From: Peter K. <pk...@us...> - 2001-04-19 10:29:14
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- l2cap_con.c 1.7 1.8=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Replaced all FNC and function names in strings with __FUNCTION__. The diff of the modified file(s): --- l2cap_con.c 2001/04/18 15:47:13 1.7 +++ l2cap_con.c 2001/04/19 10:29:14 1.8 @@ -122,9 +122,9 @@ void=20 init_con_list(void) { - con_list.first =3D 0; - con_list.last =3D 0; - con_list.cur =3D 0; + con_list.first =3D NULL; + con_list.last =3D NULL; + con_list.cur =3D NULL; con_list.count =3D 0; /* l2cap->cid_count =3D MIN_CID; Moved to l2cap_init */ } @@ -132,17 +132,17 @@ void=20 free_list(void) { - D_CON("free_list : Freeing connection list\n"); + D_CON(__FUNCTION__ ": Freeing connection list\n"); while (con_list.count) delete_con(con_list.first); - D_CON("free_list : Connection list removed\n"); + D_CON(__FUNCTION__ ": Connection list removed\n"); }=20 =20 l2cap_con*=20 create_con(u16 hci_hdl, CID lcid, CID rcid) {=20 l2cap_con* con; - D_CON("Create_con rcid %d\n", rcid); + D_CON(__FUNCTION__ ": rcid %d\n", rcid); if (con_list.count =3D=3D MAX_CONLISTSIZE) { D_ERR("Connection list full!\n"); return NULL; @@ -150,9 +150,8 @@ /* Add check if already in list ?? or rely on that otherwhere ?*/ =20=20=20 /* Allocate new element */ - if ((con =3D (l2cap_con*)kmalloc(sizeof(l2cap_con), GFP_ATOMIC))<0) - { - D_ERR("create_con : could not allocate new l2cap con\n"); + if ((con =3D kmalloc(sizeof *con, GFP_ATOMIC)) < 0) { + D_ERR(__FUNCTION__ ": could not allocate new l2cap con\n"); return NULL; } =20=09 @@ -223,27 +222,25 @@ { s32 i =3D 0; =20=20=20 - D_CON("get_con : look for connections in state %s (%d)\n",=20 + D_CON(__FUNCTION__ ": look for connections in state %s (%d)\n",=20 state_name[STATE], STATE); - PRINTPKT("get_con : look for bd : ", bd, 6); + PRINTPKT(__FUNCTION__ ": look for bd : ", bd, 6); =20=20=20 while (i<con_list.count) {=20 if (memcmp(bd, con_list.cur->remote_bd, 6) =3D=3D 0) { -=09=09=09 if (STATE =3D=3D ANY_STATE) { /* simply look for all connections with BD address bd*/ - PRINTPKT("get_con : found bd ",=20 + PRINTPKT(__FUNCTION__ ": found bd ",=20 con_list.cur->remote_bd, 6); =20 if (PARANOIA_CHECKCON(con_list.cur)) { - D_ERR("%s l.%d NULL/magic failed\n",=20 - __FILE__, __LINE__); + D_ERR(__FUNCTION__ ": Paranoia check failed\n"); return NULL; }=20=20 return con_list.cur; } else if (con_list.cur->current_state =3D=3D STATE) { - PRINTPKT("get_con : con_list bd ",=20 + PRINTPKT(__FUNCTION__": con_list bd ",=20 con_list.cur->remote_bd, 6); return con_list.cur;=20 } @@ -253,7 +250,7 @@ con_list.cur =3D con_list.cur->next; i++; } - D_CON("get_con : connection not found\n"); + D_CON(__FUNCTION__ ": connection not found\n"); return NULL; } =20 @@ -268,59 +265,51 @@ l2cap_con*=20 check_remote_cid(u16 hdl, CID remote_cid) { -#define FNC "check_remote_cid : " l2cap_con *found; l2cap_con *new_con; =20=20=20=20=20=20=20=20=20 -=20=20 - D_CON(FNC"hdl %d remote_cid %d\n", hdl, remote_cid); + D_CON(__FUNCTION__ ": hdl %d remote_cid %d\n", hdl, remote_cid); =20 found =3D get_con_hcihdl(hdl); =20 - if (found !=3D NULL) - { - D_CON(FNC"con handle found...\n"); + if (found !=3D NULL) { + D_CON(__FUNCTION__ ": con handle found...\n"); if (found->remote_cid =3D=3D 0) { -=20=20=20=20=20=20=20=20=20=20=20=20 /* This is the first l2cap connection over=20 this hci handle (remote_cid is only set=20 to 0 when receiving a new baseband=20 connection) */ =20=20=20=20=20=20=20=20=20=20=20=20=20 - D_CON(FNC"single connection / handle \n"); + D_CON(__FUNCTION__ ": single connection/handle \n"); found->remote_cid =3D remote_cid; SHOW_LIST(); return found; } else if ((found->remote_cid >=3D 0x0040)=20 && (found->remote_cid <=3D 0xffff)) { - /* at least one l2cap connection with this hci handle exist now let's create another=20 connection over same hci handle */ =20=20=20=20=20=20=20=20=20=20=20=20=20 - D_CON(FNC"multiple connections / handle \n"); + D_CON(__FUNCTION__ ": multiple connections/handle \n"); new_con =3D create_con(hdl, get_cid(),remote_cid); if (new_con =3D=3D NULL) { - D_ERR("l2cap_create_con : no connection created\n"); + D_ERR(__FUNCTION__ ": no connection created\n"); return NULL; } =20=20=20=20=20=20=20=20=20=20=20=20=20 new_con->link_up=3DTRUE; new_con->initiator=3DFALSE; /* set bd address in new connection */ - memcpy(new_con->remote_bd,=20 - found->remote_bd, 6); + memcpy(new_con->remote_bd, found->remote_bd, 6); =20=20=20=20=20=20=20=20=20=20=20=20=20 insert_con(new_con); SHOW_LIST(); return new_con; } -=20=20=20=20=20=20=20=20=20=20 } else { - D_CON(FNC"connection not found\n"); + D_CON(__FUNCTION__ ": connection not found\n"); } return NULL; -#undef FNC } =20 /* Searches list for hci handle and returns first connection found */ @@ -328,13 +317,12 @@ get_con_hcihdl(u16 hdl) { s32 i =3D 0; - D_CON("get_con_hcihdl : hdl %d\n", hdl); + D_CON(__FUNCTION__ ": hdl %d\n", hdl); =20=20=20 while (i<con_list.count) {=20 if (con_list.cur->hci_hdl =3D=3D hdl) { if (PARANOIA_CHECKCON(con_list.cur)) { - D_ERR("%s l.d%d NULL/magic failed\n",=20 - __FILE__, __LINE__); + D_ERR(__FUNCTION__ ": Paranoia check failed\n"); return NULL; } return con_list.cur; @@ -344,26 +332,24 @@ con_list.cur =3D con_list.cur->next; i++; } - D_CON("get_con_hcihdl : no more connections on this handle\n"); + D_CON(__FUNCTION__ ": no more connections on this handle\n"); return NULL;=20=20 } =20=20 =20 - /* Searches list for local cid and returns connection if found */ l2cap_con*=20 get_lcon(CID lcid) { s32 i =3D 0; - D_CON("get_lcon : lcid %d con_list.count =3D %d\n",=20 + D_CON(__FUNCTION__ ": lcid %d con_list.count =3D %d\n",=20 lcid, con_list.count); =20=20=20 while (i<con_list.count) {=20 if (lcid =3D=3D con_list.cur->local_cid) { =20=09=09=09 if (PARANOIA_CHECKCON(con_list.cur)) { - D_ERR("%s l.%d NULL/magic failed\n",=20 - __FILE__, __LINE__); + D_ERR(__FUNCTION__ ": Paranoia check failed\n"); return NULL; } return con_list.cur; @@ -373,7 +359,7 @@ con_list.cur =3D con_list.cur->next; i++; } - D_CON("get_lcon : connection lcid : %d not found\n", lcid); + D_CON(__FUNCTION__ ": connection lcid : %d not found\n", lcid); return NULL; } =20 @@ -382,14 +368,13 @@ get_rcon(CID rcid) { s32 i =3D 0; - D_CON("get_rcon : rcid %d con_list.count =3D %d\n",=20 + D_CON(__FUNCTION__ ": rcid %d con_list.count =3D %d\n",=20 rcid, con_list.count); =20=20=20 while (i<con_list.count) {=20 if (rcid =3D=3D con_list.cur->remote_cid) { if (PARANOIA_CHECKCON(con_list.cur)) { - D_ERR("%s l.%d NULL/magic failed\n",=20 - __FILE__, __LINE__); + D_ERR(__FUNCTION__ ": Paranoia check failed\n"); return NULL; } return con_list.cur; @@ -399,7 +384,7 @@ con_list.cur =3D con_list.cur->next; i++; } - D_CON("get_rcon : connection rcid : %d not found\n", rcid); + D_CON(__FUNCTION__ ": connection rcid : %d not found\n", rcid); return NULL; } =20 @@ -407,15 +392,15 @@ insert_con(l2cap_con *newcon) { l2cap_con *oldcon; - oldcon =3D con_list.first; /* mark oldcon first */ - SHOW_CON("insert_con()", newcon); + + SHOW_CON(__FUNCTION__, newcon); if (!con_list.count) { /* Empty list */ con_list.first =3D newcon;=20 con_list.cur =3D newcon; con_list.last =3D newcon; con_list.count++; - D_CON("insert_con : now %d connections\n", con_list.count); + D_CON(__FUNCTION__ ": now %d connections\n", con_list.count); newcon->next =3D con_list.first; /* Pos32 at itself */ newcon->prev =3D con_list.first; return; @@ -423,6 +408,7 @@ =20=20=20 /* Not empty */ =20=20=20 + oldcon =3D con_list.first; /* mark oldcon first */ newcon->next =3D oldcon; con_list.last->next =3D newcon; oldcon->prev =3D newcon; @@ -431,18 +417,18 @@ con_list.cur =3D newcon; /* Set current to new element */ con_list.first =3D newcon; /* Set first to new element */ con_list.count++; - D_CON("insert_con : now %d connections\n", con_list.count); + D_CON(__FUNCTION__ ": now %d connections\n", con_list.count); } =20 s32=20 delete_con(l2cap_con* con) {=20=20 if (PARANOIA_CHECKCON(con)) { - D_ERR("%s l.%d NULL/magic failed\n", __FILE__, __LINE__); + D_ERR(__FUNCTION__ ": Paranoia check failed\n"); return -1; } =20 - SHOW_CON("delete_con : ", con); + SHOW_CON(__FUNCTION__, con); =20 /* Issue a warning if connection is not in CLOSED */ if (con->current_state!=3DCLOSED) @@ -451,17 +437,16 @@ if (con_list.count =3D=3D 1) { /* Last element */ con_list.count--; - con_list.first =3D 0; - con_list.cur =3D 0; - con_list.last =3D 0; + con_list.first =3D NULL; + con_list.cur =3D NULL; + con_list.last =3D NULL; kfree(con); - con =3D NULL; D_CON("Now connection list is empty !\n"); return 0; } =20=20=20 - (con->prev)->next =3D con->next; /* Take it out */ - (con->next)->prev =3D con->prev; + con->prev->next =3D con->next; /* Take it out */ + con->next->prev =3D con->prev; =20=20=20 if (con_list.first =3D=3D con) /* Update first pointer */ con_list.first =3D con->next; @@ -473,7 +458,6 @@ con_list.count--; =20=20=20 kfree(con);=20 - con =3D NULL; =20 return 0;=20=20 } @@ -491,18 +475,16 @@ con_list.cur =3D con_list.cur->next; i++; } - D_CON("count_con : %d l2cap_con's found with hci_hdl:%d\n",sum,hci_hdl); + D_CON(__FUNCTION__ ": %d l2cap_con's found with hci_hdl:%d\n",sum,hci_hdl= ); return sum; } =20 /* only supports one call at a time */ void l2ca_wait(const char *str, l2cap_con *con) -{ - if (!(con->c_flags & FLAG_WAKEMEUP)) { - if (con->c_flags & FLAG_DONTSLEEP) - { + if (!(con->c_flags & FLAG_WAKEMEUP)) { + if (con->c_flags & FLAG_DONTSLEEP) { printk("l2ca_wait : don't sleep flag set\n"); return; } @@ -511,20 +493,16 @@ printk("%s, sleep on wq 0x%x\n", str, (int)&con->wq); interruptible_sleep_on(&con->wq); printk("%s, woke up !\n", str); - } - else - { + } else { printk("%s, wq already in use\n", str); } } =20 void=20 l2ca_wakeup(const char *str, l2cap_con *con) -{ - if (con->c_flags & FLAG_WAKEMEUP) { - if (con->c_flags & FLAG_DONTSLEEP) - { + if (con->c_flags & FLAG_WAKEMEUP) { + if (con->c_flags & FLAG_DONTSLEEP) { printk("l2ca_wakeup : don't sleep flag set\n"); con->c_flags &=3D ~FLAG_DONTSLEEP; return; @@ -533,23 +511,19 @@ con->c_flags &=3D ~FLAG_WAKEMEUP; printk("%s, wake up wq 0x%x\n", str,(int)&con->wq); wake_up_interruptible(&con->wq); - } - else - { + } else { printk("%s, wake up flag not set\n", str); } } =20 #if L2CAP_SELFTEST - - s32=20 remove_rcid(CID rcid) /* Searches for remote_cid */ { D_CON("remove_rcid\n"); =20=20=20 if (!con_list.count) { - D_CON("del_con() no connections in list\n"); + D_CON(__FUNCTION__ ": no connections in list\n"); return -1; } delete_con(get_rcon(rcid)); @@ -572,27 +546,27 @@ insert_con(create_con(5, 5, 5)); insert_con(create_con(6, 6, 6)); show_list(); - remove_rcid((u16)3); + remove_rcid(3); show_list(); - remove_rcid((u16)5); + remove_rcid(5); show_list(); free_list(); show_list(); /* ... */ } -#endif +#endif /* L2CAP_SELFTEST */ =20 void=20 show_con(const u8* head, l2cap_con* con) { if (con) {=20 - printk("show_con : %s (%d:%d) [%s] [%s] r_mtu[%d] C[%s] link_up[%s]\n", + printk(__FUNCTION__ ": %s (%d:%d) [%s] [%s] r_mtu[%d] C[%s] link_up[%s]\= n", head, con->local_cid, con->remote_cid, state_name[con->current_state], psm2str(con->psm), con->remote_mtu, bool2str[con->initiator],=20 bool2str[con->link_up]);=09=09 } else { - printk("show_con : NULL\n"); + printk(__FUNCTION__ ": NULL\n"); } } =20 @@ -618,7 +592,7 @@ void=20 init_flow(flow *f) { - D_MISC("init_flow\n"); + D_MISC(__FUNCTION__ "\n"); f->flags =3D 0; f->service =3D 0x01; f->token_rate =3D 0x00000000; /* No token rate specified, default */ @@ -631,8 +605,6 @@ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -= - */ /* Status functions for /proc files */ =20 - - s32 l2cap_sprint_con(u8 *buf, l2cap_con* con) { u16 pos=3D0; |
From: Mats F. <ma...@us...> - 2001-04-19 07:02:05
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.c 1.141 1.142=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Corrected misspelling, uint_mode -> unit_mode The diff of the modified file(s): --- hci.c 2001/04/18 15:47:13 1.141 +++ hci.c 2001/04/19 07:02:04 1.142 @@ -1538,7 +1538,7 @@ s32 pos =3D 0; s32 i; =20 - pos +=3D sprintf(buf + pos, "unit_id unit_bd_address uint_mode unit_name\= n"); + pos +=3D sprintf(buf + pos, "unit_id unit_bd_address unit_mode unit_name\= n"); =20 =20 /* Then we printout the other connections bd addresses and their user |
From: Gordon M. <gm...@us...> - 2001-04-19 00:22:12
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.169 1.170=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: --Fixed a few formatting things and return values --Fixed a kernel hang that occured with the following sequence of events: 1. insmod bt.o 2. start an app to setup the stack over a tty 3. establish an SDP connection 4. terminate the app that setup the stack without doing a BTSHUTDOWN -- t= his is the problem, because sertty now points to an invalid tty once the ap= p exits, and tty_bt_close was not setting sertty to NULL. 5. rmmod bt.o -- this tries to shutdown the SDP connection, but sertty->d= river.write is no longer a valid operation. Fixed the problem by setting sertty to NULL in bt_tty_close. Now bt_write= _lower_driver just drops the SDP disconnection request on rmmod and things = appear to clean up ok. =20=20 The diff of the modified file(s): --- bluetooth.c 2001/04/18 15:23:09 1.169 +++ bluetooth.c 2001/04/19 00:22:11 1.170 @@ -1261,6 +1261,8 @@ } line++; } + + sertty =3D NULL; } =20 /* @@ -1759,17 +1761,19 @@ =20 /* SDP connection not active! Don't issue the request */ =20 - BT_DRIVER("bt_execute_sdp_request: line %d does not have an active conne= ction!\n", line); - return -1; + BT_DRIVER(__FUNCTION__": line %d does not have an active "\ + "connection!\n", line); + return -ENOTCONN; } =20 BT_DRIVER("bt_execute_sdp_request: line %d SDP index %d\n", line, sdpIndex); + if (sdpStartRequest(sdpIndex, sdpRequest->sdpCommand, sdpRequest->pduPayload, sdpRequest->pduLength) < 0) - return -1; + return -1; /* fixme -- EPERM probably not appropriate */ =20 /* Sleep on this line while the response is going through */ =20 @@ -1780,11 +1784,17 @@ Copy into sdpRequest and return */ =20=09 if (bt_ctrl.session[line].sdpRequestResponseData) { - BT_DRIVER("bt_execute_sdp_request: sdpRequestResponseData 0x%x - copying= \n", (int)bt_ctrl.session[line].sdpRequestResponseData); + + BT_DRIVER(__FUNCTION__": sdpRequestResponseData 0x%x"\ + "- copying\n",=20 + (int)bt_ctrl.session[line].sdpRequestResponseData); + memcpy(sdpRequest->requestResponse, bt_ctrl.session[line].sdpRequestResponseData,=20 bt_ctrl.session[line].sdpRequestResponseDataLength); - sdpRequest->responseLength =3D bt_ctrl.session[line].sdpRequestResponseD= ataLength; + sdpRequest->responseLength =3D=20 + bt_ctrl.session[line].sdpRequestResponseDataLength; + } =20 return 0; @@ -1871,11 +1881,12 @@ /* When data received for this line, we simply attach the data (& length) and wake up */ =20=09 - BT_DRIVER("bt_send_sdp_data_received: data 0x%x len %d\n", (int)data, len= ); + BT_DRIVER(__FUNCTION__": data 0x%x len %d\n", (int)data, len); /* If previous data, deallocate it */ =20 if (bt_ctrl.session[line].sdpRequestResponseData) { - D_WARN("bt_send_sdp_data_received: sdpRequestResponseData set - dealloca= te\n"); + D_WARN(__FUNCTION__": sdpRequestResponseData set - "\ + "deallocate\n"); kfree(bt_ctrl.session[line].sdpRequestResponseData); bt_ctrl.session[line].sdpRequestResponseData =3D NULL; bt_ctrl.session[line].sdpRequestResponseDataLength =3D 0; @@ -2450,8 +2461,6 @@ { s32 found =3D 0; =20 - printk(__FUNCTION__ ": line =3D %d (gjm)\n", line); - if (!bt_stack_initiated) { D_WARN("bt_register_sdp : Bluetooth stack not initialized\n"); return -1;=09 @@ -2745,7 +2754,6 @@ =20 save_flags(flags); cli(); - if ((error =3D tty_unregister_driver(&bt_driver))) printk("SERIAL: failed to unregister bluetooth driver (%d)\n", error); |
From: Peter K. <pk...@us...> - 2001-04-18 15:47:16
|
The following files were modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.c 1.140 1.141=20=20=20=20=20=20=20=20=20=20=20 hci_vendor.c 1.25 1.26=20=20=20=20=20=20=20=20=20=20=20=20 l2cap_con.c 1.6 1.7=20=20=20=20=20=20=20=20=20=20=20=20=20 rfcomm.c 1.104 1.105=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Replaced -=3D1 and +=3D1 with -- and ++. The diff of the modified file(s): --- hci.c 2001/04/18 00:53:37 1.140 +++ hci.c 2001/04/18 15:47:13 1.141 @@ -391,8 +391,8 @@ */ return; } - buf +=3D 1; - count -=3D 1; + buf++; + count--; break; =20 /* If it is an event packet we wait for the next byte @@ -401,16 +401,16 @@ D_STATE(__FUNCTION__", WAIT_FOR_EVENT_TYPE\n"); event_type =3D *buf; state =3D WAIT_FOR_EVENT_LENGTH; - buf +=3D 1; - count -=3D 1;=20=20 + buf++; + count--; break; =20 /* If it is an event the length-field is one byte */ case WAIT_FOR_EVENT_LENGTH: D_STATE(__FUNCTION__", WAIT_FOR_EVENT_LENGTH\n"); event_len =3D *buf; - buf +=3D 1; - count -=3D 1; + buf++; + count--; =20 /* If we don't check this and the lower level driver gives us some trashed values then we might write @@ -492,7 +492,7 @@ D_REC(__FUNCTION__", cont frame\n"); in_buf =3D get_inbuffer(hci_hdl); if (in_buf) { - in_buf->nbr_of_hci_pkt +=3D 1; + in_buf->nbr_of_hci_pkt++; } } =20 @@ -679,7 +679,7 @@ if (j >=3D inq_res->nbr_of_units) { memcpy(inq_res->bd_addr +=20 inq_res->nbr_of_units * 6, tmp_bd, 6); - inq_res->nbr_of_units +=3D 1; + inq_res->nbr_of_units++; } } break; @@ -692,7 +692,7 @@ D_CMD(__FUNCTION__", CONNECTION_COMPLETE: %s\n", get_err_msg(buf[0])); =20 - hci_ctrl.nbr_of_connections +=3D 1; + hci_ctrl.nbr_of_connections++; =20 link_type =3D buf[9]; hci_hdl =3D CHAR2INT12(buf[2], buf[1]); @@ -706,7 +706,7 @@ /* remove hci handle if connection failed */ DSYS(__FUNCTION__", CONNECTION_COMPLETE %s\n",=20 get_err_msg(buf[0])); - hci_ctrl.nbr_of_connections -=3D 1; + hci_ctrl.nbr_of_connections--; reset_hci_con_bd(hci_hdl); } else { DSYS(__FUNCTION__", ACL link is up\n"); @@ -757,7 +757,7 @@ connection handle, if we only support point-to-point connections we can acl_num by reading the buffersizes again, but this will not work in a multipoint connection. */ - hci_ctrl.nbr_of_connections -=3D 1; + hci_ctrl.nbr_of_connections--; =20 reset_hci_con_bd(CHAR2INT12(buf[2], buf[1])); =20=09=09 @@ -1898,8 +1898,7 @@ =20 memcpy(c_pkt.data, bd, 6); c +=3D 6; - c_pkt.data[c] =3D reason; - c +=3D 1; + c_pkt.data[c++] =3D reason; c_pkt.len =3D c; =20 return send_cmd((u8*) &c_pkt ,c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN); @@ -1971,8 +1970,7 @@ =20 memcpy(c_pkt.data, bd, 6); c +=3D 6; - c_pkt.data[c] =3D pin_len; - c +=3D 1; + c_pkt.data[c++] =3D pin_len; memcpy(c_pkt.data + c, pin, 16); c +=3D 16; =20 @@ -3132,15 +3130,15 @@ {=09 if (*data =3D=3D SCO_PKT) { bt_write_lower_driver(data,len); - hci_ctrl.hc_buf.sco_num +=3D 1; + hci_ctrl.hc_buf.sco_num++; } else if (*data =3D=3D ACL_PKT) { /* forward everything to other side */ bt_write_lower_driver(data,len); - hci_ctrl.hc_buf.acl_num +=3D 1; + hci_ctrl.hc_buf.acl_num++; } else if (*data =3D=3D CMD_PKT) { /* convert command to event */ command_handler(data); - hci_ctrl.hc_buf.cmd_num +=3D 1; + hci_ctrl.hc_buf.cmd_num++; } } =20 @@ -3344,7 +3342,7 @@ cmd_buf.next_to_send =3D 0; D_CTRL(__FUNCTION__", next_to_send WRAP\n"); } else { - cmd_buf.next_to_send +=3D 1; + cmd_buf.next_to_send++; } } else { /* no cmd:s in buffer */ @@ -3377,7 +3375,7 @@ cmd_buf.first_free =3D 0; /* wrap */ D_CTRL(__FUNCTION__", WRAP\n"); } else { - cmd_buf.first_free +=3D 1; + cmd_buf.first_free++; } sti(); return 0; @@ -3465,7 +3463,7 @@ tmp->data =3D NULL; =20 cli(); - hci_ctrl.hc_buf.cmd_num -=3D 1; + hci_ctrl.hc_buf.cmd_num--; } sti(); =20=09 --- hci_vendor.c 2001/04/18 14:45:21 1.25 +++ hci_vendor.c 2001/04/18 15:47:13 1.26 @@ -183,7 +183,7 @@ } bt_write_lower_driver((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN= ); =20=20=20 - hci_ctrl.hc_buf.cmd_num -=3D 1;=20=20 + hci_ctrl.hc_buf.cmd_num--; #endif /* We don't really know if the card accepted the change, but we did succeed in trying to send it. --gmcnutt */ --- l2cap_con.c 2001/04/12 15:10:49 1.6 +++ l2cap_con.c 2001/04/18 15:47:13 1.7 @@ -486,7 +486,7 @@ =20=20=20 while (i < con_list.count) {=20 if (con_list.cur->hci_hdl =3D=3D hci_hdl) { - sum +=3D 1; + sum++; } con_list.cur =3D con_list.cur->next; i++; --- rfcomm.c 2001/04/18 15:24:23 1.104 +++ rfcomm.c 2001/04/18 15:47:13 1.105 @@ -1314,7 +1314,7 @@ u32 con_id =3D CREATE_RFCOMM_ID(rfcomm->line, tmp_dlci); =20 if (rfcomm->credit_flow) { - rfcomm->dlci[tmp_dlci].remote_credits -=3D 1; + rfcomm->dlci[tmp_dlci].remote_credits--; if (rfcomm->dlci[tmp_dlci].remote_credits <=3D 1) { /* FIXME -- possible race ? */ =20=09=09=09=09=09 @@ -1408,7 +1408,7 @@ return total; } else { if (rfcomm->credit_flow) { - rfcomm->dlci[dlci].local_credits -=3D 1; + rfcomm->dlci[dlci].local_credits--; D_CTRL(FNC"%d credits left\n", rfcomm->dlci[dlci].local_credits); } =20 @@ -2401,7 +2401,7 @@ =20 tmp =3D 61; while ((rfcomm->dlci[tmp].state =3D=3D DISCONNECTED) && (tmp > 0)) { - tmp -=3D 1; + tmp--; } =20 return tmp; |
From: Peter K. <pk...@us...> - 2001-04-18 15:24:23
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- rfcomm.c 1.103 1.104=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Return negative value in crc_check() to indicate failure. The diff of the modified file(s): --- rfcomm.c 2001/04/18 11:49:42 1.103 +++ rfcomm.c 2001/04/18 15:24:23 1.104 @@ -1095,7 +1095,7 @@ D_CTRL(FNC"SABM-packet received\n"); =20=20=20=20=20 if (crc_check((u8*) short_pkt, LONG_CRC_CHECK,=20 - short_pkt->data[0])) { + short_pkt->data[0]) < 0) { break; } =20 @@ -1232,7 +1232,7 @@ =20=20=20=20=20 case DISC: D_CTRL(FNC"DISC packet received\n"); - if (crc_check(data, LONG_CRC_CHECK, short_pkt->data[0])) { + if (crc_check(data, LONG_CRC_CHECK, short_pkt->data[0]) < 0) { break; } rfcomm =3D ((rfcomm_con*) l2cap->upper_con); @@ -1302,7 +1302,7 @@ } =20 if (crc_check(data, SHORT_CRC_CHECK, - *(uih_data_start + uih_len))) { + *(uih_data_start + uih_len)) < 0) { break; } =20=20=20=20=20 @@ -2431,7 +2431,7 @@ return 0; } else { D_ERR("crc_check: CRC check failed\n"); - return 1; + return -1; } } =20 |
From: Peter K. <pk...@us...> - 2001-04-18 15:23:11
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.168 1.169=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * Return 0 instead of 1 to indicate success in bt_ctrl_init(). * Return -EINVAL instead of 1 to indicate failure in bt_paranoia_check(). The diff of the modified file(s): --- bluetooth.c 2001/04/18 14:45:21 1.168 +++ bluetooth.c 2001/04/18 15:23:09 1.169 @@ -137,7 +137,7 @@ #define BT_TTY_DRIVER_MAGIC 0xb100b100 /* check if free...*/ #define BT_TTY_MAJOR 124 /* Experimental use */ =20 -#define BT_PARANOIA_CHECK 1 +#define BT_PARANOIA_CHECK 0 =20 /****************** TYPE DEFINITION SECTION ******************************= ***/ =20 @@ -2358,7 +2358,7 @@ bt_ctrl.tty_last_unthrottled =3D 0; bt_ctrl.ctrl_tty_count =3D 0; =20 - return 1; + return 0; } =20=20 void bt_reset_session(s32 line) @@ -2661,19 +2661,16 @@ static inline s32 bt_paranoia_check(struct tty_driver *bt_tty, kdev_t device, const u8 *rout= ine) { -#ifdef BT_PARANOIA_CHECK - static const u8 *badmagic =3D - "Warning: bad magic number for bluetooth driver struct (%s) in %s\n"; - static const char *badinfo =3D - "Warning: null tty_driver struct for (%s) in %s\n"; - +#if BT_PARANOIA_CHECK if (!bt_tty) { - printk(badinfo, kdevname(device), routine); - return 1; + printk("Warning: null tty_driver struct for (%s) in %s\n", + kdevname(device), routine); + return -EINVAL; } + if (bt_tty->magic !=3D BT_TTY_DRIVER_MAGIC) { - printk(badmagic, kdevname(device), routine); - return 1; + printk("Warning: bad magic number for bluetooth driver struct (%s) in %s= \n", kdevname(device), routine); + return -EINVAL; } #endif return 0; |