From: Gordon M. <gm...@us...> - 2001-04-01 15:50:15
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.159 1.160=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: --Fixed a bug where bt_write_top could write past the end of an allocated b= uffer. The diff of the modified file(s): --- bluetooth.c 2001/03/31 15:51:26 1.159 +++ bluetooth.c 2001/04/01 15:50:12 1.160 @@ -1373,6 +1373,11 @@ rfcomm_conid =3D CREATE_RFCOMM_ID(line, bt->dlci); =20=09 if (from_user) { + /* Our tmp_bt_buf is only one page, but nothing prevents the + * caller from giving us more than that to send. Make sure we + * don't try to write beyond the end of tmp_bt_buf. + */ + count =3D MIN(count, PAGE_SIZE); copy_from_user(tmp_bt_buf, buf, count); bytes_sent =3D rfcomm_send_data(rfcomm_conid, tmp_bt_buf, count); } else { |
From: Mattias A. <mat...@us...> - 2001-04-12 12:06:54
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.160 1.161=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: do hangup in bt_unregister_rfcomm The diff of the modified file(s): --- bluetooth.c 2001/04/01 15:50:12 1.160 +++ bluetooth.c 2001/04/12 12:06:53 1.161 @@ -2448,6 +2448,11 @@ D_WARN("bt_unregister_rfcomm : inactive session\n"); return -1; } + + /* notify upper tty that this rfcomm connection is down */ +#ifdef __KERNEL__ + bt_hangupline(line); +#endif return 0; } =20 |
From: Gordon M. <gm...@us...> - 2001-04-17 05:33:19
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.161 1.162=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: --Someone correct me if I'm wrong, but I don't think we can get a useful SD= P connection without this change. The only time we'll ever see BT_INACTIVE = on a session after starting a BTCONNECT is if the line is /dev/ttyBTC. But = if we establish an SDP connection on /dev/ttyBTC we'll never be able to use= it for BT_SDP_REQUEST ioctls because it's session state will be stuck in B= T_LOWERCONNECTED. The BT_ACTIVE state is impossible on /dev/ttyBTC. So we'l= l need to use one of the data devices, and as soon as one of these opens th= e session state goes to BT_UPPERCONNECTED. The diff of the modified file(s): --- bluetooth.c 2001/04/12 12:06:53 1.161 +++ bluetooth.c 2001/04/17 05:33:19 1.162 @@ -2412,7 +2412,8 @@ D_WARN("bt_register_sdp: Pending SDP data for this new connection @ line= %d\n", line); } =20 - if (SESSIONSTATE(line) =3D=3D BT_INACTIVE) { + if ((SESSIONSTATE(line) =3D=3D BT_INACTIVE) || + (SESSIONSTATE(line) =3D=3D BT_UPPERCONNECTED)){ /* now register ! */ DSYS("bt_register_sdp : line %d\n", line); SESSIONSTATE(line) =3D BT_ACTIVE; @@ -2503,7 +2504,7 @@ /* Data line ! */ if (!bt_stack_initiated) { D_WARN("bt_register_tty : Bluetooth stack not initiated\n"); - return -1; + return -EPERM; } } =20 |
From: Gordon M. <gm...@us...> - 2001-04-17 06:09:19
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.162 1.163=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: --Backed out my last change. A closer look shows that we can use /dev/ttyBT= C (and only /dev/ttyBTC) for SDP connections. When we open /dev/ttyBTC it r= emains in the BT_INACTIVE state. Then bt_register_sdp will move it to BT_AC= TIVE, and bt_unregister_sdp will move it back to BT_INACTIVE. This does mea= n that we can only have one SDP connection in the system at a time, so it's= still not ideal. The diff of the modified file(s): --- bluetooth.c 2001/04/17 05:33:19 1.162 +++ bluetooth.c 2001/04/17 06:09:19 1.163 @@ -2412,8 +2412,7 @@ D_WARN("bt_register_sdp: Pending SDP data for this new connection @ line= %d\n", line); } =20 - if ((SESSIONSTATE(line) =3D=3D BT_INACTIVE) || - (SESSIONSTATE(line) =3D=3D BT_UPPERCONNECTED)){ + if (SESSIONSTATE(line) =3D=3D BT_INACTIVE) { /* now register ! */ DSYS("bt_register_sdp : line %d\n", line); SESSIONSTATE(line) =3D BT_ACTIVE; |
From: Peter K. <pk...@us...> - 2001-04-17 12:07:57
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.163 1.164=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Cannot clear the buffers in bt_flush_buffer() due to how hangup works. The diff of the modified file(s): --- bluetooth.c 2001/04/17 06:09:19 1.163 +++ bluetooth.c 2001/04/17 12:07:57 1.164 @@ -466,6 +466,9 @@ 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 */ +#if 0 bt_tx_buf* tx_buf; =20 BT_DRIVER("bt_flush_buffer\n"); @@ -473,6 +476,7 @@ while ((tx_buf =3D get_bt_buf())) { unsubscribe_bt_buf(tx_buf); } +#endif } =20 static s32 |
From: Gordon M. <gm...@us...> - 2001-04-17 23:50:27
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.165 1.166=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: --Fixed a bug that could cause an SDP connection request to block the user = process indefinitely. The diff of the modified file(s): --- bluetooth.c 2001/04/17 16:05:11 1.165 +++ bluetooth.c 2001/04/17 23:50:26 1.166 @@ -1678,6 +1678,29 @@ * half to process the request and get back to us.=20=20=20 */ =20=09=09=09 + /* I seem to be having a lot of trouble with the L2CAP + traffic just not appearing on this side of the link + while I'm waiting for the SDP conneciton to finish + up. So let's start a timer to wake us up if things + don't appear to be working out. + --gmcnutt + */ + /* fixme -- we probably need a lock on this timer since + multiple processes could be trying to use it at the + same time... or maybe use one timer per session. + */ + start_wq_timer(&bt_timer, BT_CON_TIMEOUT,=20 + &bt_ctrl.connect_wq[line]); + + /* The timeout routine doesn't have a hendle to our=20 + session status, so set things up to reflect a=20 + timeout error by default. If we really do get a=20 + connection then this value _should_ be changed by + the time we wake up to reflect a good connection. + --gmcnutt + */ + bt_ctrl.session[line].connect_status =3D -ETIMEDOUT; + BT_DRIVER(FNC"sleep on line %d\n", line); interruptible_sleep_on(&bt_ctrl.connect_wq[line]); =20 @@ -2408,6 +2431,8 @@ { 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 @@ -2686,8 +2711,7 @@ #else struct wait_queue **wq =3D (struct wait_queue **)ptr; #endif /* LINUX_VERSION_CODE */ - - //printk("wq_timeout wq 0x%x\n", wq); + DSYS(__FUNCTION__"\n"); =20 /* wake up wait queue */ wake_up_interruptible(wq); |
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; |
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-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: 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: Ulf H. <ul...@us...> - 2001-04-26 13:27:21
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.172 1.173=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Added function to read cached link key The diff of the modified file(s): --- bluetooth.c 2001/04/25 17:39:13 1.172 +++ bluetooth.c 2001/04/26 13:27:21 1.173 @@ -539,7 +539,22 @@ =20 return returnValue; } +#ifdef CONFIG_BLUETOOTH_USE_SECURITY_MANAGER=20=20 + case BT_GETCACHEDLINKKEY: + { + unsigned char link_key_info[6 + 16]; =20 + /* Now execute the request */ + BT_DRIVER(FNC"Executing sec_man_get_cached_link_key\n"); + + sec_man_get_cached_link_key(link_key_info); + + BT_DRIVER(FNC"Copying data back to user space\n"); + copy_to_user((s32*)arg, link_key_info, 6 + 16); + + return 0; + } +#endif=20=20=20=20=20=20=20=20 case BTCONNECT:=20 { /* argument is an object with all info to start a remote=20 |
From: Mats F. <ma...@us...> - 2001-05-15 14:44:50
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.173 1.174=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: If using BCSP, then the incomming data should be sent to BCSP instead of HCI The diff of the modified file(s): --- bluetooth.c 2001/04/26 13:27:21 1.173 +++ bluetooth.c 2001/05/15 14:44:50 1.174 @@ -91,6 +91,10 @@ #include <linux/bluetooth/bt_proc.h> #endif =20 +#ifdef CONFIG_BLUETOOTH_USE_BCSP +#define hci_receive_data(data, len) bcsp_receive_lower(data, len) +#endif + #ifdef __CRIS__ #include <asm/io.h> #endif @@ -2309,6 +2313,9 @@ =20 DSYS("Current HW: %s\n", bt_hw_vendor()); =20 +#ifdef CONFIG_BLUETOOTH_USE_BCSP + bcsp_init(); +#endif hci_init(); l2cap_init(); =20 |
From: Peter K. <pk...@us...> - 2001-05-30 08:02:30
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.176 1.177=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: kcomp.h did not appear until linux 2.2.18 The diff of the modified file(s): --- bluetooth.c 2001/05/22 09:45:53 1.176 +++ bluetooth.c 2001/05/30 08:01:13 1.177 @@ -51,7 +51,7 @@ #include <linux/delay.h> #include <linux/timer.h> =20 -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18) # ifdef MODULE # define module_init(x) int init_module(void) { return x(); } # define module_exit(x) void cleanup_module(void) { x(); } |
From: Mattias A. <mat...@us...> - 2001-06-06 14:52:32
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.177 1.178=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * Check for CONFIG_BLUETOOTH_SUPPORT_BCSP instead of ..._USE_BCSP * Extracted reset ioctl code to separate function (bt_reset_phys_hw()) * Added ioctl for setting bcspmode * Removed unused code (forwarding ioctl to serial driver) * Added check in bt_feedstack if we really found an active line * Only init bcsp if enabled and not already syncronizied=20 (from separate ioctl) * Minor changes and cleanup The diff of the modified file(s): --- bluetooth.c 2001/05/30 08:01:13 1.177 +++ bluetooth.c 2001/06/06 14:52:31 1.178 @@ -82,7 +82,7 @@ #include <linux/bluetooth/sdp.h> #include <linux/bluetooth/sec_client.h> #include <linux/bluetooth/bt_errno.h> -#ifdef CONFIG_BLUETOOTH_USE_BCSP +#ifdef CONFIG_BLUETOOTH_SUPPORT_BCSP #include <linux/bluetooth/bcsp.h> #endif =20 @@ -612,10 +612,6 @@ return (SESSIONSTATE(line) =3D=3D BT_LOWERCONNECTED); } =20=09 - case BTSETSPEED: - BT_DRIVER(FNC"BTSETSPEED not implemented\n"); - break; -=20=20=20=20 case BTINITSTACK: bt_init_stack(); break; @@ -642,68 +638,7 @@ break; =20 case BTRESETPHYSICALHW: -#ifdef __CRIS__ - -#ifdef CONFIG_BLUETOOTH_CSR -#define CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH -#else -#undef CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH -#endif - -#if defined(CONFIG_BLUETOOTH_RESET_PA7) -#if defined(CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH) - BT_DRIVER(FNC"Resetting hardware (PA7) Active High\n"); - REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, 7, 1); - udelay(1000); - REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, 7, 0); -#else - BT_DRIVER(FNC"Resetting hardware (PA7) Active Low\n"); - REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, 7, 0); - udelay(1000); - REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, 7, 1); -#endif -#elif defined(CONFIG_BLUETOOTH_RESET_PB5) -#if defined(CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH) - BT_DRIVER(FNC"Resetting hardware (PB5) Active High\n"); - REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, 5, 1); - udelay(1000); - REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, 5, 0); -#else - BT_DRIVER(FNC"Resetting hardware (PB5) Active Low\n"); - REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, 5, 0); - udelay(1000); - REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, 5, 1); -#endif -#elif defined(CONFIG_BLUETOOTH_RESET_G10) -#if defined(CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH) - BT_DRIVER(FNC"Resetting hardware (G10) Active High\n"); - REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 10, 1); - udelay(1000); - REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 10, 0); -#else - BT_DRIVER(FNC"Resetting hardware (G10) Active Low\n "); - REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 10, 0); - udelay(1000); - REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 10, 1); -#endif -#elif defined(CONFIG_BLUETOOTH_RESET_G11) -#if defined(CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH) - BT_DRIVER(FNC"Resetting hardware (G11) Active High\n"); - REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 11, 1); - udelay(1000); - REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 11, 0); -#else - BT_DRIVER(FNC"Resetting hardware (G11) Active Low\n "); - REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 11, 0); - udelay(1000); - REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 11, 1); -#endif -#else - D_ERR(FNC"Resetting hardware : No reset pin defined\n"); -#endif -#else - BT_DRIVER(FNC"Do not know how to reset the bluetooth hardware!\n"); -#endif + bt_reset_phys_hw(); break; =20 case BTISINITIATED: @@ -1102,17 +1037,51 @@ return 0; } =20=09=09 - default:=09=09 -#if 0=09=20=20 - /* forward rest to serial driver ! */=09=09 - BT_DRIVER(FNC"forwarding ioctl 0x%x to serial driver\n", cmd); - if (sertty !=3D NULL) - return sertty->driver.ioctl(sertty, file, cmd, arg); + case BTSETBCSPMODE : + { + u8 enable; =20 - break; -#else - return -ENOIOCTLCMD; + GET_USER(tmp, (s32*)arg); + + enable =3D (u8)(tmp & 0xff); +=09=09 + BT_DRIVER("BTSETBCSPMODE : %d\n", enable); +=09=09 + bt_use_bcsp(enable); +=09=09 + return 0; + } + +#ifdef CONFIG_BLUETOOTH_CSR + + /* | ps_key (u16) | rw_mode (u16) | len (u16) | params (u16[])| */ + + case BT_CSR_PSKEY: + { + u16 u16_size =3D CSR_PSKEY_MSGHDR_SIZE + CSR_PSKEY_MAXPARAMS; + u16 msg[size]; +=09=09 + copy_from_user(msg, (u8*)arg, u16_size*sizeof(u16)); + + csr_pskey(msg[0], msg[1], &msg[3], msg[2]); +=09=09 + copy_to_user((s32*)arg, msg, u16_size*sizeof(u16)); + return 0; + } + + case BTINITBCSP: + { + printk("BTINITBCSP\n"); + if (bcsp_init() < 0) + printk("Sync failed\n"); + return 0; + } + #endif + + default:=09=09 + return -ENOIOCTLCMD; + } return 0; #undef FNC @@ -1316,7 +1285,75 @@ printk("bt_tty_wakeup : not done\n"); } =20 +void bt_reset_phys_hw(void) +{ +#define FNC __FUNCTION__": "=09 +#ifdef __CRIS__ +=09 +#ifdef CONFIG_BLUETOOTH_CSR +#define CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH +#else +#undef CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH +#endif =20 +#if defined(CONFIG_BLUETOOTH_RESET_PA7) +#if defined(CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH) + BT_DRIVER(FNC"Resetting hardware (PA7) Active High\n"); + REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, 7, 1); + udelay(1000); + REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, 7, 0); +#else + BT_DRIVER(FNC"Resetting hardware (PA7) Active Low\n"); + REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, 7, 0); + udelay(1000); + REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, 7, 1); +#endif +#elif defined(CONFIG_BLUETOOTH_RESET_PB5) +#if defined(CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH) + BT_DRIVER(FNC"Resetting hardware (PB5) Active High\n"); + REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, 5, 1); + udelay(1000); + REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, 5, 0); +#else + BT_DRIVER(FNC"Resetting hardware (PB5) Active Low\n"); + REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, 5, 0); + udelay(1000); + REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, 5, 1); +#endif +#elif defined(CONFIG_BLUETOOTH_RESET_G10) +#if defined(CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH) + BT_DRIVER(FNC"Resetting hardware (G10) Active High\n"); + REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 10, 1); + udelay(1000); + REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 10, 0); +#else + BT_DRIVER(FNC"Resetting hardware (G10) Active Low\n "); + REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 10, 0); + udelay(1000); + REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 10, 1); +#endif +#elif defined(CONFIG_BLUETOOTH_RESET_G11) +#if defined(CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH) + BT_DRIVER(FNC"Resetting hardware (G11) Active High\n"); + REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 11, 1); + udelay(1000); + REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 11, 0); +#else + BT_DRIVER(FNC"Resetting hardware (G11) Active Low\n "); + REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 11, 0); + udelay(1000); + REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 11, 1); +#endif +#else + D_ERR(FNC"Resetting hardware : No reset pin defined\n"); +#endif +#else + BT_DRIVER(FNC"Do not know how to reset the bluetooth hardware!\n"); +#endif +#undef FNC +} + + /************************/ /* glue layer functions */ /************************/ @@ -1328,7 +1365,7 @@ =20 s32 bt_write_lower_driver(u8 *data, s32 len) -#ifdef CONFIG_BLUETOOTH_USE_BCSP +#ifdef CONFIG_BLUETOOTH_SUPPORT_BCSP { if (bt_use_bcsp(-1)) return bcsp_write_top(data, len); @@ -1540,7 +1577,10 @@ check_line =3D 0; } =20 - /* found an active */ + /* check if we really found an active */ + if (nbr_checked > BT_NBR_DATAPORTS) + return; + //BT_DATA("bt_feedstack : wakeup line %d !\n", check_line); upper_tty =3D GET_UPPERTTY(check_line); bt_ctrl.tty_last_unthrottled =3D check_line; @@ -1664,7 +1704,7 @@ static void bt_receive_data(u8* data, u32 count) { -#ifdef CONFIG_BLUETOOTH_USE_BCSP +#ifdef CONFIG_BLUETOOTH_SUPPORT_BCSP if (bt_use_bcsp(-1)) bcsp_receive_lower(data, count); else @@ -2308,6 +2348,7 @@ s32 bt_use_bcsp(s32 new_use_bcsp) { +/* default val */ #ifdef CONFIG_BLUETOOTH_USE_BCSP static s32 use_bcsp =3D 1; #else @@ -2317,14 +2358,12 @@ =20 if (new_use_bcsp >=3D 0) { -#ifdef CONFIG_BLUETOOTH_USE_BCSP +#ifdef CONFIG_BLUETOOTH_SUPPORT_BCSP use_bcsp =3D new_use_bcsp; #endif } - return old; } - void bt_init_stack(void) { @@ -2356,7 +2395,10 @@ =20 DSYS("Current HW: %s\n", bt_hw_vendor()); =20 -#ifdef CONFIG_BLUETOOTH_USE_BCSP + btmem_init(); + +#ifdef CONFIG_BLUETOOTH_SUPPORT_BCSP + if (bt_use_bcsp(-1) && !bcsp_issyncronized()) bcsp_init(); #endif hci_init(); @@ -2369,7 +2411,7 @@ sdp_init(1); /* For now always init as server */ tcs_init(); #endif - btmem_init(); + bt_stack_initiated =3D 1; bt_stat.bytes_received =3D 0; bt_stat.bytes_sent =3D 0; @@ -2755,12 +2797,15 @@ tcs_shutdown(); l2cap_shutdown(); hci_shutdown(); - btmem_shutdown(); - bt_stack_initiated =3D 0; =20 -#ifdef CONFIG_BLUETOOTH_USE_BCSP +#ifdef CONFIG_BLUETOOTH_SUPPORT_BCSP + if (bt_use_bcsp(-1)) bcsp_shutdown(); #endif + + btmem_shutdown(); + + bt_stack_initiated =3D 0; =20=09 if (tmp_bt_buf) { free_page((unsigned long) tmp_bt_buf); |
From: Mats F. <ma...@us...> - 2001-06-07 06:49:10
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.178 1.179=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Undefine BTINITBCSP when not supporting bcsp The diff of the modified file(s): --- bluetooth.c 2001/06/06 14:52:31 1.178 +++ bluetooth.c 2001/06/07 06:49:09 1.179 @@ -1069,6 +1069,7 @@ return 0; } =20 +#ifdef CONFIG_BLUETOOTH_SUPPORT_BCSP case BTINITBCSP: { printk("BTINITBCSP\n"); @@ -1076,6 +1077,7 @@ printk("Sync failed\n"); return 0; } +#endif =20 #endif =20 |
From: Mattias A. <mat...@us...> - 2001-06-13 12:41:04
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.179 1.180=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * Added/Modified some debug * added fail checks for bcsp init and hci init * added semaphore protection around bt_ioctl * added bt_wait_tx() which waits for serial dma to finish tx=20 (used in non blocking set baudrate commands) * use return value in bt_init_stack to signal failed init to usermode The diff of the modified file(s): --- bluetooth.c 2001/06/07 06:49:09 1.179 +++ bluetooth.c 2001/06/13 12:10:44 1.180 @@ -190,7 +190,7 @@ static void bt_receive_data(u8* data, u32 count); =20 static void bt_show_version(void); -static void bt_init_stack(void); +static s32 bt_init_stack(void); static s32 bt_ctrl_init(void); static s32 bt_connect(u8 *bd_addr, u32 con_id); static s32 bt_disconnect(u32 con_id); @@ -252,6 +252,12 @@ =20 /****************** LOCAL VARIABLE DECLARATION SECTION *******************= ***/ =20 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) +static struct semaphore ioctl_sem =3D MUTEX; +#else +static struct semaphore ioctl_sem; +#endif /* LINUX_VERSION_CODE */ + static struct bt_ctrl_struct bt_ctrl; =20 /* some defines for easier reading */ @@ -489,8 +495,9 @@ #endif } =20 + static s32 -bt_ioctl(struct tty_struct *tty, struct file * file, +__bt_ioctl(struct tty_struct *tty, struct file * file, u32 cmd, unsigned long arg) { #define FNC "bt_ioctl: " @@ -613,7 +620,7 @@ } =20=09 case BTINITSTACK: - bt_init_stack(); + return bt_init_stack(); break; =20 case BTSHUTDOWN: @@ -623,7 +630,8 @@ case BTREADREMOTEBDADDR: BT_DRIVER(FNC"BTREADREMOTEBDADDR\n"); =20 - /* FIXME -- add parameter do get remote bd from any connected device */ + /* FIXME -- add parameter do get remote bd from any + connected device */ get_remote_bd(bd_addr); =20 { @@ -802,6 +810,7 @@ case HCICREATE_NEW_UNIT_KEY: { s32 result; + BT_DRIVER(FNC"HCICREATE_NEW_UNIT_KEY\n"); result =3D hci_create_new_unit_link_key(); put_user(result, (s32*)arg); break; @@ -851,7 +860,7 @@ /* FIXME: If we send the length of the string too, we don't have to copy all the 248 byte... */ u8 local_name[248]; - + BT_DRIVER(FNC"HCISETLOCALNAME\n"); copy_from_user(local_name, (s32*)arg, 248); hci_change_local_name(local_name); break; @@ -859,14 +868,13 @@ =20 case HCIREADSCANENABLE: BT_DRIVER("Reading scan enable\n"); - tmp =3D hci_read_scan_enable(); put_user(tmp, (s32*)arg); break; =20=09 case HCIWRITESCANENABLE: GET_USER(tmp, (s32*)arg); - BT_DRIVER("setting write scan enable : [0x%x]\n", tmp); + BT_DRIVER("Setting write scan enable : [0x%x]\n", tmp); hci_write_scan_enable(tmp); break; =20=09=09 @@ -874,7 +882,7 @@ { u32 par[2]; copy_from_user(&par, (s32*)arg, size); - BT_DRIVER("setting write page scan activity : [0x%x,0x%x]\n",=20 + BT_DRIVER("Setting write page scan activity : [0x%x,0x%x]\n",=20 par[0], par[1]); hci_write_pagescan_activity(par[0], par[1]); break; @@ -883,6 +891,7 @@ case HCIWRITECLASSOFDEVICE: { u8 class_of_device[3]; + BT_DRIVER(FNC"HCIWRITECLASSOFDEVICE\n"); copy_from_user(class_of_device, (s32*)arg, size); hci_write_class_of_device(class_of_device); break; @@ -891,6 +900,7 @@ case HCIREAD_AUTHENTICATION_ENABLE: { s32 result =3D hci_read_authentication_enable(); + BT_DRIVER(FNC"HCIREAD_AUTHENTICATION_ENABLE\n"); put_user(result, (s32*)arg); break; } @@ -899,7 +909,7 @@ { u8 enable; s32 result =3D 0; - + BT_DRIVER(FNC"HCIWRITE_AUTHENTICATION_ENABLE\n"); GET_USER(tmp, (s32*)arg); =20 enable =3D (u8)(tmp & 0xff); @@ -911,6 +921,7 @@ case HCIREAD_ENCRYPTION_MODE: { s32 result =3D hci_read_encryption_mode(); + BT_DRIVER(FNC"HCIREAD_ENCRYPTION_MODE\n"); put_user(result, (s32*)arg); break; } @@ -919,7 +930,7 @@ { u8 enable; s32 result =3D 0; -=09=09 + BT_DRIVER(FNC"HCIWRITE_ENCRYPTION_MODE\n"); GET_USER(tmp, (s32*)arg); =20 enable =3D (u8)(tmp & 0xff); @@ -932,6 +943,7 @@ case HCISET_EVENT_FILTER: { u8 param[size]; + BT_DRIVER(FNC"HCISET_EVENT_FILTER\n"); copy_from_user(param, (s32*)arg, size); =20=09=09 hci_set_event_filter(param); @@ -967,23 +979,27 @@ /* ioctls vendor specific HCI commands */ =20=09=09 case HCISETBAUDRATE: + {=09 + s32 tmp; /* Set baudrate in hardware */=20 GET_USER(tmp, (s32*)arg); BT_DRIVER(FNC"Setting baudrate in host controller to %d\n", tmp); -=09=09 - return hci_set_baudrate(tmp); + tmp =3D hci_set_baudrate(tmp); + return tmp; + } =20 case HCIWRITEBDADDR: copy_from_user(&bd_addr, (s32*)arg, size); - BT_DRIVER(FNC"setting BD_ADDR to \n"); + BT_DRIVER(FNC"Setting BD_ADDR to \n"); print_data("bd :",(u8*)bd_addr,6); hci_set_bd_addr(bd_addr); break;=20=20 =20=20=20=20=20=20 + /* | len (1) | hci header (4) | data (max 256)| */ case HCISENDRAWDATA: { u8 len; - u8 data[261]; /* | len (1) | hci header (4) | data (max 256)| */ + u8 data[261]; =20 /* first byte contains length of whole hci message */ copy_from_user(&len, (u8*)arg, 1); @@ -1053,16 +1069,14 @@ } =20 #ifdef CONFIG_BLUETOOTH_CSR - /* | ps_key (u16) | rw_mode (u16) | len (u16) | params (u16[])| */ - case BT_CSR_PSKEY: { u16 u16_size =3D CSR_PSKEY_MSGHDR_SIZE + CSR_PSKEY_MAXPARAMS; u16 msg[size]; =20=09=09 copy_from_user(msg, (u8*)arg, u16_size*sizeof(u16)); - + BT_DRIVER("BT_CSR_PSKEY [ps:%d type:%d]\n", msg[0], msg[1]); csr_pskey(msg[0], msg[1], &msg[3], msg[2]); =20=09=09 copy_to_user((s32*)arg, msg, u16_size*sizeof(u16)); @@ -1072,14 +1086,13 @@ #ifdef CONFIG_BLUETOOTH_SUPPORT_BCSP case BTINITBCSP: { - printk("BTINITBCSP\n"); + BT_DRIVER("BTINITBCSP\n"); if (bcsp_init() < 0) printk("Sync failed\n"); return 0; } #endif - -#endif +#endif /* CONFIG_BLUETOOTH_CSR */ =20 default:=09=09 return -ENOIOCTLCMD; @@ -1089,6 +1102,19 @@ #undef FNC } =20 +static s32 +bt_ioctl(struct tty_struct *tty, struct file * file, + u32 cmd, unsigned long arg) +{ + s32 tmp; + //printk(__FUNCTION__"[%s:%x] lock !\n", current->comm, cmd); + down(&ioctl_sem); + //printk(__FUNCTION__"[%s:%x] running...\n", current->comm, cmd); + tmp =3D __bt_ioctl(tty, file, cmd, arg); + up(&ioctl_sem); + return tmp; +} + static void bt_throttle(struct tty_struct * tty) { @@ -1188,9 +1214,6 @@ u32 cmd, unsigned long arg) { #define FNC "bt_tty_ioctl: " - BT_LDISC("bt_tty_ioctl cmd 0x%x\n", cmd); -=20=20 - /* FIXME - paranoia check */ =20=20=20 switch (cmd) { =20 @@ -1355,7 +1378,6 @@ #undef FNC } =20 - /************************/ /* glue layer functions */ /************************/ @@ -1610,6 +1632,15 @@ #undef FNC } =20 +/* Used to wait for dma to finish transmission */ +void bt_wait_tx(s32 trim_delay) +{ + s32 cnt; + while ((cnt =3D sertty->driver.chars_in_buffer(sertty)) > 0) + udelay(100); + udelay(trim_delay); +} + #ifdef CONFIG_BLUETOOTH_USE_INBUFFER static void bt_handle_indata(const __u8 *data, s32 count) { @@ -2332,6 +2363,12 @@ hci_data.get =3D hci_data.head;; #endif =20 +#ifdef __KERNEL__ +#if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,4,0) + sema_init(&ioctl_sem, 1); +#endif /* LINUX_VERSION_CODE */ +#endif /* __KERNEL__ */ + return 0; /*success*/ } =20 @@ -2366,7 +2403,8 @@ } return old; } -void + +s32 bt_init_stack(void) { unsigned long page;=09 @@ -2400,10 +2438,20 @@ btmem_init(); =20 #ifdef CONFIG_BLUETOOTH_SUPPORT_BCSP - if (bt_use_bcsp(-1) && !bcsp_issyncronized()) - bcsp_init(); + if (bt_use_bcsp(-1) && !bcsp_issyncronized()) {=20=20 + if (bcsp_init() < 0){ + bcsp_shutdown(); + goto init_failed_exit0; + } + } #endif - hci_init(); + + /* Always check if hci succeeded */ + if (hci_init() < 0){ + D_ERR("HCI failed to initialize\n"); + goto init_failed_exit1; + } +=09 l2cap_init(); =20 #ifdef CONFIG_BLUETOOTH_USE_TCI @@ -2428,6 +2476,19 @@ bt_clear_led_timer.expires =3D jiffies + HZ/10; add_timer(&bt_clear_led_timer); #endif + return 0; + + init_failed_exit1:=20 + printk("init_failed_exit1\n"); + hci_shutdown(); + init_failed_exit0: + printk("init_failed_exit0\n"); + btmem_shutdown(); + if (tmp_bt_buf) { + free_page((unsigned long) tmp_bt_buf); + tmp_bt_buf =3D NULL; + } + return -1; } =20 #ifdef BT_USELINEBUF @@ -2691,8 +2752,8 @@ if (line =3D=3D BT_NBR_PORTS-BT_NBR_CTRLPORTS) { NBR_CTRL_FDS++; =20=09=09 - DSYS("Now %d open fd:s for ttyBTC\n",=20 - NBR_CTRL_FDS); + BT_DRIVER("Now %d open fd:s for ttyBTC [%s]\n",=20 + NBR_CTRL_FDS, current->comm); if (NBR_CTRL_FDS > 1) return 0; /* already registered state */ } else { |
From: Mattias A. <mat...@us...> - 2001-06-13 13:16:05
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.180 1.181=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * removed unecessary variable * changed some debug The diff of the modified file(s): --- bluetooth.c 2001/06/13 12:10:44 1.180 +++ bluetooth.c 2001/06/13 12:45:14 1.181 @@ -595,7 +595,7 @@ /* check if we already have a connection otherwise wait... */ if ((SESSIONSTATE(line) =3D=3D BT_LOWERCONNECTED)|| (SESSIONSTATE(line) =3D=3D BT_ACTIVE)) { - printk("Already got connection on line %d\n", line);=20 + BT_DRIVER("Already got connection on line %d\n", line);=20 return 0; } BT_DRIVER("Waiting on line %d\n", line); @@ -1635,8 +1635,7 @@ /* Used to wait for dma to finish transmission */ void bt_wait_tx(s32 trim_delay) { - s32 cnt; - while ((cnt =3D sertty->driver.chars_in_buffer(sertty)) > 0) + while (sertty->driver.chars_in_buffer(sertty) > 0) udelay(100); udelay(trim_delay); } |
From: Mats F. <ma...@us...> - 2001-06-14 10:59:59
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.181 1.182=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Actually we shouldn't do bt_feedstack when the rfcomm flow is stopped, but for now this is disabled by default, since we don't know which dlci we are using here... The diff of the modified file(s): --- bluetooth.c 2001/06/13 12:45:14 1.181 +++ bluetooth.c 2001/06/14 10:59:58 1.182 @@ -1561,6 +1561,8 @@ return 0; } =20 +//#define IMPROVE_RFCOMM_FLOW + void bt_feedstack(void) { #define FNC "bt_feedstack: " @@ -1614,6 +1616,13 @@ return; } =20=09 +#ifdef IMPROVE_RFCOMM_FLOW + /* FIXME: How should we know what serverchannel we are using ? */ + if (rfcomm_flow_stop(check_line, 2)) { + BT_DATA(__FUNCTION__": Flow stopped in RFCOMM\n"); + return; + } +#endif if ((upper_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && upper_tty->ldisc.write_wakeup) { //BT_DATA(" |X|<<*** [%d]\n", check_line); |
From: Peter K. <pk...@us...> - 2001-06-19 10:34:37
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.184 1.185=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Added BTFIRMWAREINFO ioctl. The diff of the modified file(s): --- bluetooth.c 2001/06/19 06:13:01 1.184 +++ bluetooth.c 2001/06/19 10:34:34 1.185 @@ -654,6 +654,11 @@ copy_to_user((u8*)arg, bt_hw_vendor(), strlen(bt_hw_vendor())+1); break; =20 + case BTFIRMWAREINFO: + BT_DRIVER(FNC"BTFIRMWAREINFO\n"); + copy_to_user((u8*)arg, bt_hw_firmware(), strlen(bt_hw_firmware())+1); + break; + case BTSENDTESTDATA: copy_from_user(&tmp, (s32*)arg, 4); copy_from_user(&utmp, (s32*)arg + 1, 4); |
From: Mattias A. <mat...@us...> - 2001-06-29 10:46:30
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.185 1.186=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * Added function that searches a data buffer for number of complete packet events. If only NCP was found, return 1. Otherwize return 0. The diff of the modified file(s): --- bluetooth.c 2001/06/19 10:34:34 1.185 +++ bluetooth.c 2001/06/29 10:46:29 1.186 @@ -1743,6 +1743,43 @@ } } #endif /* CONFIG_BLUETOOTH_USE_INBUFFER */ + + +/*=20 + * Searches data buffer for number of completed packets (NCP)=20 + * If only NCP data was found tell serial driver not to=20 + * schedule a flip of DMA inbuffer. + */ +int bt_catch_ncp(u8* data, u32 count) +{ + int ncp_len; + int index =3D 0; + + /* fixme -- do this for BCSP as well */ +#ifdef CONFIG_BLUETOOTH_SUPPORT_BCSP + if (bt_use_bcsp(-1)) + return 0; +#endif + + /* || uart hdr | event code | par_len | nbr_handles | [data...] || */ + + while (((index+2) < count) && (data[index] =3D=3D 0x4) &&=20 + (data[index+1] =3D=3D 0x13) ) { + /* we found a NCP */ + index +=3D (3 + data[index + 2]); /* event hdr + par len */ + } + + if (index =3D=3D count) { + /* Contains _only_ NCP data, parse it ! */ + bt_receive_data(data, count); + return 1; + } +=09 + /* Contains more than NCP data, tell serial=20 + driver to queue it up as usual */ + return 0; +} + =20 static void bt_receive_data(u8* data, u32 count) |
From: Olov H. <ol...@us...> - 2001-07-10 12:54:20
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.186 1.187=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Added support to set max number of BT connections The diff of the modified file(s): --- bluetooth.c 2001/06/29 10:46:29 1.186 +++ bluetooth.c 2001/07/10 12:54:20 1.187 @@ -1055,6 +1055,20 @@ return 0; } =20 + /* Set max number of connections */ + case BTSETMAXCONNECTIONS : + { + u8 max_connections; + + GET_USER(tmp, (s32*)arg); + + max_connections =3D (u8)(tmp & 0xff); +=09=09 + BT_DRIVER("BTSETMAXCONNECTIONS : %d\n", max_connections); + hci_set_max_connections(max_connections); + return 0; + } + case BTSETBCSPMODE : { u8 enable; |
From: Peter K. <pk...@us...> - 2001-07-31 18:47:42
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.188 1.189=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * Fixed a couple of compiler warnings. * Corrected indentation. The diff of the modified file(s): --- bluetooth.c 2001/07/30 10:15:51 1.188 +++ bluetooth.c 2001/07/31 18:47:41 1.189 @@ -82,6 +82,7 @@ #include <linux/bluetooth/sdp.h> #include <linux/bluetooth/sec_client.h> #include <linux/bluetooth/bt_errno.h> +#include <linux/bluetooth/test.h> #ifdef CONFIG_BLUETOOTH_SUPPORT_BCSP #include <linux/bluetooth/bcsp.h> #endif @@ -675,7 +676,6 @@ /* First byte is length */=20 case BTTESTCOMMAND: { - extern void test_process_cmd(unsigned char *cmd, s32 size); u8 cmd[261]; =20 copy_from_user(cmd, (u8*)arg, 260); @@ -1546,7 +1546,7 @@ struct tty_struct *upper_tty; u32 line; =20 - line =3D (con_id >> 8) & 0xff; + line =3D GET_RFCOMMLINE(con_id); =20=09 /* get upper tty and call its ldisc->receive_buf */ =20 @@ -1769,7 +1769,6 @@ */ int bt_catch_ncp(u8* data, u32 count) { - int ncp_len; int index =3D 0; =20 /* fixme -- do this for BCSP as well */ @@ -1939,36 +1938,28 @@ case L2CAP_TEST_LAYER: case L2CAP_TEST2_LAYER: case L2CAP_TEST3_LAYER: - { line =3D (con_id & 0x0000ffff); BT_DRIVER(FNC"Connecting TEST_LAYER (psm %02X) on line %d\n", GET_PSM(c= on_id), line); =20 /* Check the line to assure no other connections on it */ =20 if ((SESSIONSTATE(line) =3D=3D BT_LOWERCONNECTED) || - (SESSIONSTATE(line) =3D=3D BT_ACTIVE))=20 - { + (SESSIONSTATE(line) =3D=3D BT_ACTIVE)) { D_WARN("already got connection on line %d\n", line);=20 return -1; } =20=09=20=20 - if(test_connect_psmreq(bd_addr, GET_PSM(con_id)) < 0) - { + if(test_connect_psmreq(bd_addr, GET_PSM(con_id)) < 0) { BT_DRIVER("bt_connect failed\n"); return bt_ctrl.session[line].connect_status; } =20=20=20=20=20 return bt_ctrl.session[line].connect_status; - } - break; + case TCS_LAYER: - { return tcs_connect_req(bd_addr); - } - break; =20=09=20=20 -=09=20=20=20=20 default:=20=20=20=20 BT_DRIVER(FNC"PSM %d not supported as client\n", GET_PSM(con_id)); break; @@ -2127,13 +2118,13 @@ bt_disconnect(u32 con_id) { int line; + switch(GET_PSM(con_id)) { case RFCOMM_LAYER: - { line =3D GET_RFCOMMLINE(con_id); - BT_DRIVER("bt_disconnect : Disconnecting line %d (ONLY RFCOMM)\n",=20 - GET_RFCOMMLINE(con_id)); + BT_DRIVER(__FUNCTION__ ": Disconnecting line %d (ONLY RFCOMM)\n",=20 + line); =20 CHECK_RFCOMM(con_id); =20=09=20=20=20=20 @@ -2141,57 +2132,42 @@ =20=09=20=20=20=20 /* 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)=20 - { - BT_DRIVER("bt_disconnect failed\n"); + (SESSIONSTATE(line) =3D=3D BT_ACTIVE)) { + if (rfcomm_disconnect_req(line) < 0) { + BT_DRIVER(__FUNCTION__ ": Failed\n"); return bt_ctrl.session[line].disconnect_status; } =20 /* fixme -- remove timers, useless when rfcomm blocks ? */ =20=20=20=20=20=20=20=20=20=20=20 /* Sleep if not yet disconnected */ - if (bt_ctrl.session[line].disconnect_status =3D=3D -1)=20 - { + 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_INTERFAC= E,=20 - BT_NOTCONNECTED); + } else { + bt_ctrl.session[line].disconnect_status =3D + MSGCODE(MSG_BT_INTERFACE, BT_NOTCONNECTED); } return bt_ctrl.session[line].disconnect_status; - break; - } =20=09=20=20 case L2CAP_TEST_LAYER: - { - extern l2cap_con *testcon; test_disconnect_req(testcon); /* extern l2cap_con set in test.c */ return bt_ctrl.session[line].disconnect_status; - break; - } + case L2CAP_TEST2_LAYER: - { - extern l2cap_con *testcon2; test_disconnect_req(testcon2); return bt_ctrl.session[line].disconnect_status; - break; - } + case L2CAP_TEST3_LAYER: - { - extern l2cap_con *testcon3; test_disconnect_req(testcon3); return bt_ctrl.session[line].disconnect_status; - break; - } + default: - BT_DRIVER("bt_disconnect: Can't disconnect this layer (PSM %x)\n", GE= T_PSM(con_id)); + BT_DRIVER(__FUNCTION__ ": Can't disconnect this layer (PSM %x)\n", GET_P= SM(con_id)); + return -EINVAL; } } =20 |
From: Mattias A. <mat...@us...> - 2001-08-02 15:13:50
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.189 1.190=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * added ioctl HCIREADCOUNTRYCODE * added some comments The diff of the modified file(s): --- bluetooth.c 2001/07/31 18:47:41 1.189 +++ bluetooth.c 2001/08/02 15:13:20 1.190 @@ -973,6 +973,13 @@ } break; =20=09=09 + case HCIREADCOUNTRYCODE: + BT_DRIVER(FNC"HCIREADCOUNTRYCODEn"); +=09=09 + tmp =3D hci_read_country_code(); + put_user(tmp, (s32*) arg); + break; +=09=09 /* Status Parameters */ =20 /* Testing Commands */ @@ -2171,6 +2178,8 @@ } } =20 +/* This function is currently not used in OpenBT for any useful stuff, + however other ports of OpenBT uses this to notify applications */ void bt_disconnect_ind(u32 con_id)=20 { @@ -2306,10 +2315,11 @@ bt_driver.refcount =3D &bluetooth_refcount; bt_driver.table =3D bt_table;=20 =20 - /* temp setting, should point to serial drivers termios */ bt_driver.termios =3D bt_termios; bt_driver.termios_locked =3D bt_termios_locked; =20=20 + /* Register the interface against usermode applications */ + bt_driver.open =3D bt_open; bt_driver.close =3D bt_close; bt_driver.write =3D bt_write_top; @@ -2333,6 +2343,7 @@ =20 /* * Register the tty discipline + * (Interface against lower hardware driver) */ =20=09 memset(&bt_ldisc, 0, sizeof(bt_ldisc)); @@ -2793,7 +2804,6 @@ } =20 s32 - bt_unregister_rfcomm(s32 line) { BT_DRIVER("bt_unregister_rfcomm : line %d\n", line);=09 |
From: Peter K. <pk...@us...> - 2001-08-29 09:35:08
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.190 1.191=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: The BTSETBCSPMODE ioctl can now return the old mode. The diff of the modified file(s): --- bluetooth.c 2001/08/02 15:13:20 1.190 +++ bluetooth.c 2001/08/29 09:35:07 1.191 @@ -718,7 +718,6 @@ kfree(inq_res);=09=09 hci_inq_exit0: return ret; - break; } =20=09 case HCILINKKEYREPLY: @@ -1081,15 +1080,12 @@ =20 case BTSETBCSPMODE : { - u8 enable; - GET_USER(tmp, (s32*)arg); - - enable =3D (u8)(tmp & 0xff); =20=09=09 - BT_DRIVER("BTSETBCSPMODE : %d\n", enable); + BT_DRIVER("BTSETBCSPMODE: %d\n", tmp); =20=09=09 - bt_use_bcsp(enable); + tmp =3D bt_use_bcsp(tmp); + put_user(tmp, (s32*)arg); =20=09=09 return 0; } |
From: Peter K. <pk...@us...> - 2001-09-10 11:17:12
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.192 1.193=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Clean-up (basically use of __FUNCTION__ for debug messages, and a rewrite of bt_reset_phys_hw()). The diff of the modified file(s): --- bluetooth.c 2001/09/07 12:53:24 1.192 +++ bluetooth.c 2001/09/10 11:17:11 1.193 @@ -414,7 +414,7 @@ s32 line =3D GET_TTYLINE(tty); s32 ret_val; =20=09 - BT_DRIVER("bt_open on line %d\n", line);=09 + BT_DRIVER(__FUNCTION__ ": Line %d\n", line);=09 =20=09 ret_val =3D bt_register_tty(tty) ; =20 @@ -432,7 +432,7 @@ { s32 line =3D GET_TTYLINE(tty); =20 - BT_DRIVER("bt_close on line %d\n", line); + BT_DRIVER(__FUNCTION__ ": Line %d\n", line); =20 /* FIXME - flush channels etc */ /* close rfcomm channel associated with this tty ?? */ @@ -446,14 +446,14 @@ static void bt_put_char(struct tty_struct *tty, u8 ch) { - BT_DRIVER("bt_put_char %c\n", ch); + BT_DRIVER(__FUNCTION__ ": %c\n", ch); bt_write_top(tty, 0, &ch, 1); } =20 static void bt_flush_chars(struct tty_struct *tty) { - BT_DRIVER("bt_flush_chars\n"); + BT_DRIVER(__FUNCTION__ "\n"); if (sertty !=3D NULL && sertty->driver.flush_chars) sertty->driver.flush_chars(sertty); } @@ -464,7 +464,7 @@ { s32 n =3D buf_write_room(); =20 - BT_DRIVER("bt_write_room : %d\n", n); + BT_DRIVER(__FUNCTION__ ": %d\n", n); return n; } =20 @@ -473,7 +473,7 @@ { u16 n =3D buf_byte_count(GET_TTYLINE(tty)); =20 - BT_DRIVER("bt_chars_in_buffer : %d\n", n); + BT_DRIVER(__FUNCTION__ ": %d\n", n); return n; } =20 @@ -482,7 +482,7 @@ { /* 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"); + BT_DRIVER(__FUNCTION__ ": Ignored\n"); #if 0 bt_tx_buf* tx_buf; while ((tx_buf =3D get_bt_buf())) { @@ -496,7 +496,6 @@ __bt_ioctl(struct tty_struct *tty, struct file * file, u32 cmd, unsigned long arg) { -#define FNC "bt_ioctl: " s32 tmp; u32 utmp; s32 err =3D 0; @@ -533,55 +532,54 @@ =20 /* Copy arguments to kernel space */ =20 - BT_DRIVER(FNC"Copying arguments from user to kernel space\n"); + BT_DRIVER(__FUNCTION__ ": Copying arguments from user to kernel space\n"= ); copy_from_user(&sdpRequest, (s32*)arg, size); =20=09=09 /* Now execute the request */ =20 - BT_DRIVER(FNC"Executing bt_execute_sdp_request\n"); + BT_DRIVER(__FUNCTION__ ": Executing bt_execute_sdp_request\n"); =20 if ((returnValue =3D bt_execute_sdp_request(&sdpRequest)) >=3D 0) { =20 /* Copy the data back to user space and return */ =20 - BT_DRIVER(FNC"Copying data back to user space\n"); + BT_DRIVER(__FUNCTION__ ": Copying data back to user space\n"); copy_to_user((s32*)arg, &sdpRequest, size); } =20 return returnValue; } + #ifdef CONFIG_BLUETOOTH_USE_SECURITY_MANAGER=20=20 case BT_GETCACHEDLINKKEY: { unsigned char link_key_info[6 + 16]; =20 /* Now execute the request */ - BT_DRIVER(FNC"Executing sec_man_get_cached_link_key\n"); + BT_DRIVER(__FUNCTION__ ": Executing sec_man_get_cached_link_key\n"); =20 sec_man_get_cached_link_key(link_key_info); =20 - BT_DRIVER(FNC"Copying data back to user space\n"); + BT_DRIVER(__FUNCTION__ ": Copying data back to user space\n"); copy_to_user((s32*)arg, link_key_info, 6 + 16); =20 return 0; } #endif=20=20=20=20=20=20=20=20 + case BTCONNECT:=20 - { /* argument is an object with all info to start a remote=20 connection */ - copy_from_user(&btcon, (s32*)arg, size); =20 - BT_DRIVER(FNC"BTCONNECT\n"); -=09=09=09=20=20=20=20=20=20=20 + BT_DRIVER(__FUNCTION__ ": BTCONNECT\n"); return bt_connect(btcon.bd, btcon.id); - } =20=09 case BTDISCONNECT: { s32 con_id; - BT_DRIVER(FNC"BTDISCONNECT\n"); + + BT_DRIVER(__FUNCTION__ ": BTDISCONNECT\n"); copy_from_user(&con_id, (s32*)arg, size); return bt_disconnect(con_id); } @@ -589,6 +587,7 @@ case BTWAITFORCONNECTION: { s32 line; + copy_from_user(&line, (s32*)arg, size); =20 /* check if we already have a connection otherwise wait... */ @@ -604,23 +603,21 @@ } =20=09 case BTWAITNEWCONNECTIONS: - { /* wait for any new connections coming in */ BT_DRIVER("Waiting for new connections\n"); interruptible_sleep_on(&bt_ctrl.any_wq); break; - } =20 case BTISLOWERCONNECTED: { s32 line;=09=20=20 + copy_from_user(&line, (s32*)arg, size); return (SESSIONSTATE(line) =3D=3D BT_LOWERCONNECTED); } =20=09 case BTINITSTACK: return bt_init_stack(); - break; =20 case BTSHUTDOWN: bt_shutdown(); @@ -632,7 +629,7 @@ s32 line;=09=20=20 u16 i; =20 - BT_DRIVER(FNC"BTREADREMOTEBDADDR\n"); + BT_DRIVER(__FUNCTION__ ": BTREADREMOTEBDADDR\n"); =20 copy_from_user(&line, (s32*)arg, size); =20 @@ -659,7 +656,7 @@ break; =20 case BTFIRMWAREINFO: - BT_DRIVER(FNC"BTFIRMWAREINFO\n"); + BT_DRIVER(__FUNCTION__ ": BTFIRMWAREINFO\n"); copy_to_user((u8*)arg, bt_hw_firmware(), strlen(bt_hw_firmware())+1); break; =20 @@ -672,6 +669,7 @@ case HCITESTCONNECTREQ: { u8 bd[6]; + copy_from_user(bd, (s32*)arg, 6); return hci_test_connect_req(bd); } @@ -698,7 +696,7 @@ u8 lap[3]; int ret; =20=09=09 - BT_DRIVER(FNC"HCINQUIRY\n"); + BT_DRIVER(__FUNCTION__ ": HCINQUIRY\n"); =20=09=09 copy_from_user(in_param, (s32*)arg, 8); =20 @@ -728,7 +726,7 @@ u8 param[size]; s32 result; =20=09=09 - BT_DRIVER(FNC"HCILINKKEYREPLY\n"); + BT_DRIVER(__FUNCTION__ ": HCILINKKEYREPLY\n"); copy_from_user(param, (s32*)arg, size); /* First part of param contains BD address, last part link key, see Bluetooth specification for more info*/ @@ -742,7 +740,7 @@ u8 bd_addr[size]; s32 result; =20=09=09 - BT_DRIVER(FNC"HCILINKKEYNEGATIVEREPLY\n"); + BT_DRIVER(__FUNCTION__ ": HCILINKKEYNEGATIVEREPLY\n"); copy_from_user(bd_addr, (s32*)arg, size); result =3D hci_link_key_request_negative_reply(bd_addr); put_user(result, (s32*)arg); @@ -754,7 +752,7 @@ u8 param[size]; s32 result; =20=09=09 - BT_DRIVER(FNC"HCIPINCODEREPLY\n"); + BT_DRIVER(__FUNCTION__ ": HCIPINCODEREPLY\n"); copy_from_user(param, (s32*)arg, size); /* First part of param contains BD address, second part of the pin code, and the last part och the pin code length */ @@ -768,7 +766,7 @@ u8 bd_addr[size]; s32 result; =20=09=09 - BT_DRIVER(FNC"HCIPINCODENEGATIVEREPLY\n"); + BT_DRIVER(__FUNCTION__ ": HCIPINCODENEGATIVEREPLY\n"); copy_from_user(bd_addr, (s32*)arg, size); result =3D hci_pin_code_request_negative_reply(bd_addr); put_user(result, (s32*)arg); @@ -779,7 +777,7 @@ { u8 bd_addr[size]; =20=09=09 - BT_DRIVER(FNC"HCIAUTHENTICATION_REQUESTED\n"); + BT_DRIVER(__FUNCTION__ ": HCIAUTHENTICATION_REQUESTED\n"); copy_from_user(bd_addr, (s32*)arg, size); hci_authentication_requested_bd(bd_addr); break; @@ -789,7 +787,7 @@ { u8 param[7]; =20=09=09=09=09 - BT_DRIVER(FNC"HCISETCONNECTION_ENCRYPTION\n"); + BT_DRIVER(__FUNCTION__ ": HCISETCONNECTION_ENCRYPTION\n"); copy_from_user(param, (s32*)arg, size); hci_set_connection_encryption_bd(param + 1, *param); break; @@ -799,6 +797,7 @@ case HCISWITCHROLE: { u8 param[size]; + copy_from_user(param, (s32*)arg, size); =20=09=09 hci_switch_role(¶m[0], param[6]); @@ -817,7 +816,8 @@ case HCICREATE_NEW_UNIT_KEY: { s32 result; - BT_DRIVER(FNC"HCICREATE_NEW_UNIT_KEY\n"); + + BT_DRIVER(__FUNCTION__ ": HCICREATE_NEW_UNIT_KEY\n"); result =3D hci_create_new_unit_link_key(); put_user(result, (s32*)arg); break; @@ -828,7 +828,7 @@ s32 result; u8 param[size]; =20 - BT_DRIVER(FNC"HCIREADSTOREDLINKKEY\n"); + BT_DRIVER(__FUNCTION__ ": HCIREADSTOREDLINKKEY\n"); copy_from_user(param, (s32*)arg, size); =20 result =3D hci_read_stored_link_key(param + 1, *param); @@ -841,7 +841,7 @@ s32 result; u8 param[size]; =20=09=09 - BT_DRIVER(FNC"HCIWRITESTOREDLINKKEY\n"); + BT_DRIVER(__FUNCTION__ ": HCIWRITESTOREDLINKKEY\n"); copy_from_user(param, (s32*)arg, size); =20=09=09 result =3D hci_write_stored_link_key(param, param + 6); @@ -854,7 +854,7 @@ s32 result; u8 param[size]; =20 - BT_DRIVER(FNC"HCIDELETESTOREDLINKKEY\n"); + BT_DRIVER(__FUNCTION__ ": HCIDELETESTOREDLINKKEY\n"); copy_from_user(param, (s32*)arg, size); =20 result =3D hci_delete_stored_link_key(param + 1, *param); @@ -867,7 +867,8 @@ /* FIXME: If we send the length of the string too, we don't have to copy all the 248 byte... */ u8 local_name[248]; - BT_DRIVER(FNC"HCISETLOCALNAME\n"); + + BT_DRIVER(__FUNCTION__ ": HCISETLOCALNAME\n"); copy_from_user(local_name, (s32*)arg, 248); hci_change_local_name(local_name); break; @@ -888,6 +889,7 @@ case HCIWRITEPAGESCANACTIVITY: { u32 par[2]; + copy_from_user(&par, (s32*)arg, size); BT_DRIVER("Setting write page scan activity : [0x%x,0x%x]\n",=20 par[0], par[1]); @@ -898,7 +900,8 @@ case HCIWRITECLASSOFDEVICE: { u8 class_of_device[3]; - BT_DRIVER(FNC"HCIWRITECLASSOFDEVICE\n"); + + BT_DRIVER(__FUNCTION__ ": HCIWRITECLASSOFDEVICE\n"); copy_from_user(class_of_device, (s32*)arg, size); hci_write_class_of_device(class_of_device); break; @@ -907,7 +910,8 @@ case HCIREAD_AUTHENTICATION_ENABLE: { s32 result =3D hci_read_authentication_enable(); - BT_DRIVER(FNC"HCIREAD_AUTHENTICATION_ENABLE\n"); + + BT_DRIVER(__FUNCTION__ ": HCIREAD_AUTHENTICATION_ENABLE\n"); put_user(result, (s32*)arg); break; } @@ -916,7 +920,8 @@ { u8 enable; s32 result =3D 0; - BT_DRIVER(FNC"HCIWRITE_AUTHENTICATION_ENABLE\n"); + + BT_DRIVER(__FUNCTION__ ": HCIWRITE_AUTHENTICATION_ENABLE\n"); GET_USER(tmp, (s32*)arg); =20 enable =3D (u8)(tmp & 0xff); @@ -928,7 +933,8 @@ case HCIREAD_ENCRYPTION_MODE: { s32 result =3D hci_read_encryption_mode(); - BT_DRIVER(FNC"HCIREAD_ENCRYPTION_MODE\n"); + + BT_DRIVER(__FUNCTION__ ": HCIREAD_ENCRYPTION_MODE\n"); put_user(result, (s32*)arg); break; } @@ -937,7 +943,8 @@ { u8 enable; s32 result =3D 0; - BT_DRIVER(FNC"HCIWRITE_ENCRYPTION_MODE\n"); + + BT_DRIVER(__FUNCTION__ ": HCIWRITE_ENCRYPTION_MODE\n"); GET_USER(tmp, (s32*)arg); =20 enable =3D (u8)(tmp & 0xff); @@ -950,7 +957,8 @@ case HCISET_EVENT_FILTER: { u8 param[size]; - BT_DRIVER(FNC"HCISET_EVENT_FILTER\n"); + + BT_DRIVER(__FUNCTION__ ": HCISET_EVENT_FILTER\n"); copy_from_user(param, (s32*)arg, size); =20=09=09 hci_set_event_filter(param); @@ -960,23 +968,24 @@ /* Informational Parameters */ =20 case HCIREADLOCALBDADDR: - BT_DRIVER(FNC"HCIREADLOCALBDADDR\n"); -=09=09 - hci_read_local_bd(bd_addr); - { BD_ADDR rev_bd; u16 i; + + BT_DRIVER(__FUNCTION__ ": HCIREADLOCALBDADDR\n"); +=09=09 + hci_read_local_bd(bd_addr); + /* return as big endian */ for (i =3D 0; i < 6; i++) { rev_bd[5-i] =3D bd_addr[i]; } copy_to_user((s32*)arg, rev_bd, 6); - } break; + } =20 case HCIREADCOUNTRYCODE: - BT_DRIVER(FNC"HCIREADCOUNTRYCODEn"); + BT_DRIVER(__FUNCTION__ ": HCIREADCOUNTRYCODE\n"); =20=09=09 tmp =3D hci_read_country_code(); put_user(tmp, (s32*) arg); @@ -995,16 +1004,17 @@ case HCISETBAUDRATE: {=09 s32 tmp; + /* Set baudrate in hardware */=20 GET_USER(tmp, (s32*)arg); - BT_DRIVER(FNC"Setting baudrate in host controller to %d\n", tmp); + BT_DRIVER(__FUNCTION__ ": Setting baudrate in host controller to %d\n", = tmp); tmp =3D hci_set_baudrate(tmp); return tmp; } =20=09 case HCIWRITEBDADDR: copy_from_user(&bd_addr, (s32*)arg, size); - BT_DRIVER(FNC"Setting BD_ADDR to \n"); + BT_DRIVER(__FUNCTION__ ": Setting BD_ADDR to\n"); print_data("bd :",(u8*)bd_addr,6); hci_set_bd_addr(bd_addr); break; @@ -1048,7 +1058,7 @@ copy_from_user(&bd, (u8*)arg, 6); copy_from_user(&type, (u8*)arg + 6, 2); =20 - BT_DRIVER("l2ca_getinfo : type %d\n", type); + BT_DRIVER("BTGETINFO: Type %d\n", type); =20=09=09 return l2ca_getinfo(bd, type); } @@ -1082,16 +1092,13 @@ } =20 case BTSETBCSPMODE: - { GET_USER(tmp, (s32*)arg); =20 BT_DRIVER("BTSETBCSPMODE: %d\n", tmp); =20=09=09 tmp =3D bt_use_bcsp(tmp); put_user(tmp, (s32*)arg); - return 0; - } =20 #ifdef CONFIG_BLUETOOTH_CSR /* | ps_key (u16) | rw_mode (u16) | len (u16) | params (u16[])| */ @@ -1111,26 +1118,21 @@ =20 #ifdef CONFIG_BLUETOOTH_SUPPORT_BCSP case BTINITBCSP: - { BT_DRIVER("BTINITBCSP\n"); if (bcsp_init() < 0) { printk("Sync failed\n"); return -ETIMEDOUT; } return 0; - } =20 case BT_SET_DFU_MODE: - { GET_USER(tmp, (s32*)arg); =20 BT_DRIVER("BT_SET_DFU_MODE: %d\n", tmp); =20 tmp =3D bt_dfu_mode(tmp); put_user(tmp, (s32*)arg); - return 0; - } =20 case BT_SEND_DFU_COMMAND: { @@ -1174,10 +1176,9 @@ =20 default:=09=09 return -ENOIOCTLCMD; - } + return 0; -#undef FNC } =20 static s32 @@ -1186,9 +1187,9 @@ { s32 tmp; =20 -// printk(__FUNCTION__"[%s:%x] lock !\n", current->comm, cmd); +// printk(__FUNCTION__ ": [%s:%x] lock !\n", current->comm, cmd); down(&ioctl_sem); -// printk(__FUNCTION__"[%s:%x] running...\n", current->comm, cmd); +// printk(__FUNCTION__ ": [%s:%x] running...\n", current->comm, cmd); tmp =3D __bt_ioctl(tty, file, cmd, arg); up(&ioctl_sem); return tmp; @@ -1197,43 +1198,43 @@ static void bt_throttle(struct tty_struct * tty) { - BT_DRIVER("bt_throttle (nothing done)\n"); + BT_DRIVER(__FUNCTION__ ": Nothing done\n"); } =20 static void bt_unthrottle(struct tty_struct * tty) { - BT_DRIVER("bt_unthrottle (nothing done)\n"); + BT_DRIVER(__FUNCTION__ ": Nothing done\n"); } =20 =20 static void bt_set_termios(struct tty_struct *tty, struct termios *old_termios) { - BT_DRIVER("bt_set_termios - forwarding to serial driver\n"); + BT_DRIVER(__FUNCTION__ ": Forwarding to serial driver\n"); =20 /* modify serial tty not bt tty */ if (sertty !=3D NULL) sertty->driver.set_termios(sertty, old_termios); else - D_ERR("bt_set_termios : no sertty set !!\n"); + D_ERR(__FUNCTION__ ": No sertty set!!\n"); } =20 static void bt_start(struct tty_struct *tty) { - BT_DRIVER("bt_start (nothing done)\n"); + BT_DRIVER(__FUNCTION__ ": Nothing done\n"); } =20 static void bt_stop(struct tty_struct *tty) { - BT_DRIVER("bt_stop (nothing done)\n"); + BT_DRIVER(__FUNCTION__ ": Nothing done\n"); } =20 void bt_hangup(struct tty_struct *tty) { - BT_DRIVER("bt_hangup on line %d (nothing done) pid %d (%s)\n", + BT_DRIVER(__FUNCTION__ ": Line %d (nothing done) pid %d (%s)\n", GET_TTYLINE(tty), current->pid, current->comm); } =20 @@ -1260,7 +1261,7 @@ #endif { /* should not read data directly over serial tty */ - BT_LDISC("bt_tty_read (disabled)\n"); + BT_LDISC(__FUNCTION__ ": Disabled\n"); return 0; } =20 @@ -1282,7 +1283,7 @@ { /* should simply discard data since ttySx only exists for internal use */ - BT_LDISC("bt_tty_write (%d) done !x\n", count); + BT_LDISC(__FUNCTION__ ": (%d) done!\n", count); =20=20=20 return tty->driver.write(tty, 1/*from user*/, data, count); } @@ -1292,19 +1293,15 @@ bt_tty_ioctl(struct tty_struct *tty, struct file * file, u32 cmd, unsigned long arg) { -#define FNC "bt_tty_ioctl: " - switch (cmd) { - default: /* forward rest to n_tty line discipline, it takes care of termios settings etc, the rest goes to the tty driver=20 (serial driver) */ - BT_LDISC(FNC"forwarding ioctl 0x%x to n_tty line disc\n", cmd); + BT_LDISC(__FUNCTION__ ": Forwarding ioctl 0x%x to n_tty line disc\n", cm= d); return n_tty_ioctl(tty, file, cmd, arg); } return -ENOIOCTLCMD; -#undef FNC } =20 #ifdef __USE_OLD_SYMTAB__ @@ -1315,7 +1312,7 @@ bt_tty_select(struct tty_struct *tty, struct inode *inode, struct file *filp, s32 sel_type, select_table * wait) { - BT_LDISC("bt_tty_select (nothing done!)\n"); + BT_LDISC(__FUNCTION__ ": Nothing done!\n"); return 0; } #else @@ -1326,7 +1323,7 @@ struct file *file, struct poll_table_struct *wait) { - BT_LDISC("bt_tty_poll (nothing done!)\n"); + BT_LDISC(__FUNCTION__ ": Nothing done!\n"); return 0; } #endif @@ -1334,7 +1331,7 @@ static s32 bt_tty_open(struct tty_struct *tty) { - BT_LDISC("bt_tty_open\n"); + BT_LDISC(__FUNCTION__ "\n"); DSYS("Setting BT driver to use serial tty\n"); sertty =3D tty; return 0; @@ -1374,7 +1371,7 @@ static s32 bt_tty_room(struct tty_struct *tty) { - BT_LDISC("bt_tty_room (return 65536 !)\n"); + BT_LDISC(__FUNCTION__ ": Return 65536!\n"); return 65536; /* We can handle an infinite amount of data. :-) */ } =20 @@ -1386,75 +1383,44 @@ static void bt_tty_wakeup(struct tty_struct *tty) { - printk("bt_tty_wakeup : not done\n"); + printk(__FUNCTION__ ": Nothing done\n"); } =20 void bt_reset_phys_hw(void) { -#define FNC __FUNCTION__": "=09 #ifdef __CRIS__ -=09 #ifdef CONFIG_BLUETOOTH_CSR -#define CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH + int do_reset =3D 1; #else -#undef CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH + int do_reset =3D 0; #endif =20 #if defined(CONFIG_BLUETOOTH_RESET_PA7) -#if defined(CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH) - BT_DRIVER(FNC"Resetting hardware (PA7) Active High\n"); - REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, 7, 1); - udelay(1000); - REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, 7, 0); -#else - BT_DRIVER(FNC"Resetting hardware (PA7) Active Low\n"); - REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, 7, 0); + BT_DRIVER(__FUNCTION__ ": Resetting Bluetooth hardware using pin PA7 (Act= ive %s)\n", (do_reset ? "High" : "Low")); + REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, 7, do_reset); udelay(1000); - REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, 7, 1); -#endif + REG_SHADOW_SET(R_PORT_PA_DATA, port_pa_data_shadow, 7, !do_reset); #elif defined(CONFIG_BLUETOOTH_RESET_PB5) -#if defined(CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH) - BT_DRIVER(FNC"Resetting hardware (PB5) Active High\n"); - REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, 5, 1); - udelay(1000); - REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, 5, 0); -#else - BT_DRIVER(FNC"Resetting hardware (PB5) Active Low\n"); - REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, 5, 0); + BT_DRIVER(__FUNCTION__ ": Resetting Bluetooth hardware using pin PB5 (Act= ive %s)\n", (do_reset ? "High" : "Low")); + REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, 5, do_reset); udelay(1000); - REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, 5, 1); -#endif + REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, 5, !do_reset); #elif defined(CONFIG_BLUETOOTH_RESET_G10) -#if defined(CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH) - BT_DRIVER(FNC"Resetting hardware (G10) Active High\n"); - REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 10, 1); - udelay(1000); - REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 10, 0); -#else - BT_DRIVER(FNC"Resetting hardware (G10) Active Low\n "); - REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 10, 0); + BT_DRIVER(__FUNCTION__ ": Resetting Bluetooth hardware using pin G10 (Act= ive %s)\n", (do_reset ? "High" : "Low")); + REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 10, do_reset); udelay(1000); - REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 10, 1); -#endif + REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 10, !do_reset); #elif defined(CONFIG_BLUETOOTH_RESET_G11) -#if defined(CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH) - BT_DRIVER(FNC"Resetting hardware (G11) Active High\n"); - REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 11, 1); - udelay(1000); - REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 11, 0); -#else - BT_DRIVER(FNC"Resetting hardware (G11) Active Low\n "); - REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 11, 0); + BT_DRIVER(__FUNCTION__ ": Resetting Bluetooth hardware using pin G11 (Act= ive %s)\n", (do_reset ? "High" : "Low")); + REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 11, do_reset); udelay(1000); - REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 11, 1); -#endif + REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 11, !do_reset); #else - D_ERR(FNC"Resetting hardware : No reset pin defined\n"); + D_ERR(__FUNCTION__ ": Resetting Bluetooth hardware: No reset pin defined\= n"); #endif #else - BT_DRIVER(FNC"Do not know how to reset the bluetooth hardware!\n"); -#endif -#undef FNC + BT_DRIVER(__FUNCTION__ ": Do not know how to reset the Bluetooth hardware= !\n"); +#endif /* __CRIS__ */ } =20 /************************/ @@ -1462,8 +1428,7 @@ /************************/ =20 /* - * HCI calls this function to write to lower layer=20 - * driver + * HCI calls this function to write to lower layer driver */ =20 s32 @@ -1480,10 +1445,8 @@ bt_write_lower_driver_real(u8 *data, s32 len) #endif { -#define FNC "bt_write_lower_driver: " - if (len < 0) { /* (!) */ - D_ERR("Can't write neg length...\n"); + D_ERR(__FUNCTION__ ": Can't write negative length...\n"); return 0; } =20=09 @@ -1497,7 +1460,7 @@ s32 sent; =20=09=09 if ((tmp =3D sertty->driver.write_room(sertty)) < len){ - printk("ser tx buffers can't send all, wait (%d/%d)\n", + printk(__FUNCTION__ ": ser tx buffers can't send all, wait (%d/%d)\n", tmp, len); return 0; } else { @@ -1507,7 +1470,7 @@ } =20=09=09 if (sent !=3D len) { - printk(FNC"Only sent %d of total %d\n",=20 + printk(__FUNCTION__ ": Only sent %d of total %d\n",=20 sent, len); /* fixme -- discard packet and add tx error in stat */ } @@ -1515,10 +1478,9 @@ =20 return sent; } else { - D_ERR(FNC"no sertty is set\n"); + D_ERR(__FUNCTION__ ": No sertty is set\n"); } return 0; -#undef FNC } =20 /* @@ -1552,7 +1514,6 @@ bt_write_top(struct tty_struct * tty, s32 from_user, const u8 *buf, s32 count) { -#define FNC "bt_write_top" s32 line =3D GET_TTYLINE(tty); s32 bytes_sent; u32 rfcomm_conid; @@ -1564,13 +1525,13 @@ bt =3D (bt_session *)tty->driver_data; =20=09 if ((bt->rfcomm !=3D NULL) && (bt->rfcomm->magic !=3D RFCOMM_MAGIC)) { - D_ERR(FNC": rfcomm magic failed (0x%x !=3D 0x%x)\n",=20 + D_ERR(__FUNCTION__ ": rfcomm magic failed (0x%x !=3D 0x%x)\n",=20 bt->rfcomm->magic, RFCOMM_MAGIC); return 0; } =20 if (SESSIONSTATE(line) !=3D BT_ACTIVE) { - D_WARN("bt_write_top : line %d is not in active state\n", + D_WARN(__FUNCTION__ ": Line %d is not in active state\n", line); return 0; } @@ -1592,7 +1553,6 @@ bt_stat.bytes_sent +=3D bytes_sent; =20 return bytes_sent; -#undef FNC } =20 /* @@ -1618,11 +1578,11 @@ =20 #ifdef BT_USELINEBUF /* WINDOZE FIX */ - BT_DATA("bt_receive_top : (%d) line %d not active yet..., buffer it !\n"= , len, line); + BT_DATA(__FUNCTION__ ": (%d) line %d not active yet..., buffer it !\n", = len, line); /* FIXME -- only buffer first packet ? */ bt_linebuf_add(line, data, len); #else - BT_DATA("bt_receive_top : (%d) line %d not active yet... silent discard!= \n", len, line); + BT_DATA(__FUNCTION__ ": (%d) line %d not active yet... silent discard!\n= ", len, line); #endif return 0; } @@ -1634,7 +1594,7 @@ if (upper_tty) { upper_tty->ldisc.receive_buf(upper_tty, data, NULL, len);=20=20 } else { -// D_ERR("No upper tty registered !!!\n"); +// D_ERR(__FUNCTION__ ": No upper tty registered !!!\n"); return -1; } return 0; @@ -1644,7 +1604,6 @@ =20 void bt_feedstack(void) { -#define FNC "bt_feedstack: " struct tty_struct *upper_tty =3D NULL; s32 check_line; s32 nbr_checked =3D 0; @@ -1671,7 +1630,7 @@ check_line =3D bt_ctrl.tty_last_unthrottled+1;=09 } =20=09=09 -// BT_DATA("bt_feedstack : start on line %d\n", check_line); +// BT_DATA(__FUNCTION__ ": Start on line %d\n", check_line); =20=09=09 /* skip non-active and control port (last) */ while ((SESSIONSTATE(check_line) !=3D BT_ACTIVE) &&=20 @@ -1686,7 +1645,7 @@ if (nbr_checked > BT_NBR_DATAPORTS) return; =20 -// BT_DATA("bt_feedstack : wakeup line %d !\n", check_line); +// BT_DATA(__FUNCTION__ ": Wakeup line %d !\n", check_line); upper_tty =3D GET_UPPERTTY(check_line); bt_ctrl.tty_last_unthrottled =3D check_line; =20=09=09 @@ -1717,7 +1676,6 @@ // BT_DATA(" |X|<<*** [%d] (n_tty)\n", check_line); wake_up_interruptible(&upper_tty->write_wait); } -#undef FNC } =20 /* Used to wait for dma to finish transmission */ @@ -1751,7 +1709,7 @@ if (hci_data.put >=3D hci_data.get) { /* check for overruns... */ if (hci_data.put + count - BT_INBUFFER_SIZE >=3D hci_data.get) { - D_ERR("bt_handle_indata : buffer overrun!\n"); + D_ERR(__FUNCTION__ ": Buffer overrun!\n"); } else { /* Calculate how much space there is left at the end=20 of the buffer */ @@ -1770,7 +1728,7 @@ /* hci_data.put < hci_data.get */ /* check for overruns ... */ if (hci_data.put + count >=3D hci_data.get) { - D_ERR("bt_handle_indata: buffer overrun!\n"); + D_ERR(__FUNCTION__ ": Buffer overrun!\n"); } else { /* Copy the data to the buffer */ memcpy(hci_data.put, (u8*)data, count); @@ -1878,8 +1836,6 @@ { u8 line;=09=09=09=09 =20 -#define FNC "bt_connect : " -=09 switch (GET_PSM(con_id)) { case RFCOMM_LAYER: { @@ -1892,19 +1848,19 @@ /* check if we already have a connection otherwise wait... */ if ((SESSIONSTATE(line) =3D=3D BT_LOWERCONNECTED)|| (SESSIONSTATE(line) =3D=3D BT_ACTIVE)) { - D_WARN("already got connection on line %d\n",=20 + D_WARN(__FUNCTION__ ": Already got connection on line %d\n",=20 GET_RFCOMMLINE(con_id));=20 return -1; }=20 =20 bt_ctrl.session[line].connect_status =3D -1; =20 - BT_DRIVER(FNC"Connecting srv ch %d on line %d\n", + BT_DRIVER(__FUNCTION__ ": Connecting srv ch %d on line %d\n", srv_ch, line); BT_DATADUMP("Remote BD : ", bd_addr, 6); =20 if (rfcomm_connect_req(bd_addr, srv_ch, line) < 0){ - BT_DRIVER("bt_connect failed\n"); + BT_DRIVER(__FUNCTION__ ": 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=20 @@ -1931,14 +1887,14 @@ =20 if ((SESSIONSTATE(line) =3D=3D BT_LOWERCONNECTED) || (SESSIONSTATE(line) =3D=3D BT_ACTIVE)) { - D_WARN("already got connection on line %d\n", + D_WARN(__FUNCTION__ ": Already got connection on line %d\n", GET_SDPLINE(con_id));=20 return -1; } =20 /* Initiate the connection */ =20 - BT_DRIVER(FNC"Connecting SDP on line %d\n", line); + BT_DRIVER(__FUNCTION__ ": Connecting SDP on line %d\n", line); BT_DATADUMP("Remote BD : ", bd_addr, 6); if ((sdp_connection_id =3D sdp_connect_req(bd_addr, line)) >=3D 0) { =20=09=09=20=20 @@ -1972,7 +1928,7 @@ */ bt_ctrl.session[line].connect_status =3D -ETIMEDOUT; =20 - BT_DRIVER(FNC"sleep on line %d\n", line); + BT_DRIVER(__FUNCTION__ ": Sleep on line %d\n", line); interruptible_sleep_on(&bt_ctrl.connect_wq[line]); =20 /*=20 @@ -1981,7 +1937,7 @@ * Therefore return the sdp_connection_id=20=20=20=20=20=20=20=20=20=20= =20=20 */ =20=09=09=09 - BT_DRIVER(FNC"Wake up - line %d\n", line); + BT_DRIVER(__FUNCTION__ ": Wake up - line %d\n", line); if (bt_ctrl.session[line].connect_status >=3D 0) { return_value =3D sdp_connection_id; } else { @@ -1999,19 +1955,19 @@ case L2CAP_TEST2_LAYER: case L2CAP_TEST3_LAYER: line =3D (con_id & 0x0000ffff); - BT_DRIVER(FNC"Connecting TEST_LAYER (psm %02X) on line %d\n", GET_PSM(co= n_id), line); + BT_DRIVER(__FUNCTION__ ": Connecting TEST_LAYER (psm %02X) on line %d\n"= , GET_PSM(con_id), line); =20 /* Check the line to assure no other connections on it */ =20 if ((SESSIONSTATE(line) =3D=3D BT_LOWERCONNECTED) || (SESSIONSTATE(line) =3D=3D BT_ACTIVE)) { - D_WARN("already got connection on line %d\n", + D_WARN(__FUNCTION__ ": Already got connection on line %d\n", line);=20 return -1; } =20 if(test_connect_psmreq(bd_addr, GET_PSM(con_id)) < 0) { - BT_DRIVER("bt_connect failed\n"); + BT_DRIVER(__FUNCTION__ ": Failed\n"); return bt_ctrl.session[line].connect_status; } =20=20=20=20=20 @@ -2021,11 +1977,11 @@ return tcs_connect_req(bd_addr); =20=09=20=20=20=20 default:=20=20=20=20 - BT_DRIVER(FNC"PSM %d not supported as client\n", GET_PSM(con_id)); + BT_DRIVER(__FUNCTION__ ": PSM %d not supported as client\n", + GET_PSM(con_id)); break; } return -1; -#undef FNC } =20 static s32 bt_execute_sdp_request(bt_sdp_request *sdpRequest) @@ -2037,12 +1993,11 @@ =20 /* SDP connection not active! Don't issue the request */ =20 - BT_DRIVER(__FUNCTION__": line %d does not have an active "\ - "connection!\n", line); + 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", + BT_DRIVER(__FUNCTION__ ": Line %d SDP index %d\n", line, sdpIndex); =20 if (sdpStartRequest(sdpIndex, @@ -2053,7 +2008,7 @@ =20 /* Sleep on this line while the response is going through */ =20 - printk("bt_execute_sdp_request: sleep on line %d\n", line); + printk(__FUNCTION__ ": Sleep on line %d\n", line); interruptible_sleep_on(&bt_ctrl.connect_wq[line]); =20 /* If we're back, there may be data to send back. @@ -2061,8 +2016,7 @@ =20=09 if (bt_ctrl.session[line].sdpRequestResponseData) { =20 - BT_DRIVER(__FUNCTION__": sdpRequestResponseData 0x%x"\ - "- copying\n",=20 + BT_DRIVER(__FUNCTION__ ": sdpRequestResponseData 0x%x - copying\n",=20 (int)bt_ctrl.session[line].sdpRequestResponseData); =20 memcpy(sdpRequest->requestResponse, @@ -2080,10 +2034,10 @@ bt_connect_ind(u32 con_id)=20 { if (GET_PSM(con_id) =3D=3D RFCOMM_LAYER) - BT_DRIVER("bt_connect_ind : RFCOMM dlci : %d\n",=20 + BT_DRIVER(__FUNCTION__ ": RFCOMM dlci : %d\n",=20 GET_RFCOMMDLCI(con_id)); else - BT_DRIVER("bt_connect_ind : psm %d\n", GET_PSM(con_id)); + BT_DRIVER(__FUNCTION__ ": PSM %d\n", GET_PSM(con_id)); } =20 void @@ -2096,19 +2050,18 @@ =20 switch (psm) { case RFCOMM_LAYER: - line =3D GET_RFCOMMLINE(con_id); CHECK_RFCOMM(con_id); =20 if ((line < 0) || (line > BT_NBR_DATAPORTS)) { =20=09=09=20=20 - D_ERR("bt_connect_cfm on invalid line (%d)\n", line); + D_ERR(__FUNCTION__ ": Invalid line (%d)\n", line); return; } =20 bt_ctrl.session[line].connect_status =3D status; =20 - BT_DRIVER("bt_connect_cfm, line %d [%s]\n", + BT_DRIVER(__FUNCTION__ ": Line %d [%s]\n", GET_RFCOMMLINE(con_id), psmname(psm)); =20 release_wq_timer(&bt_timer); @@ -2121,26 +2074,26 @@ =20 /* Check incoming line for validity */ if ((line < 0) || (line > BT_NBR_DATAPORTS)) { - D_ERR("bt_connect_cfm on invalid line (%d)\n", line); + D_ERR(__FUNCTION__ ": Invalid line (%d)\n", line); return; } =20 /* Record the connection status for bt_connect() to process. */ =20 bt_ctrl.session[line].connect_status =3D status; - BT_DRIVER("bt_connect_cfm, line %d [%s]\n", GET_SDPLINE(con_id), psmname= (psm)); - BT_DRIVER("wake up line %d\n", line); + BT_DRIVER(__FUNCTION__ ": Line %d [%s]\n", GET_SDPLINE(con_id), psmname(= psm)); + BT_DRIVER(__FUNCTION__ ": Wake up line %d\n", line); release_wq_timer(&bt_timer); wake_up_interruptible(&bt_ctrl.connect_wq[line]); wake_up_interruptible(&bt_ctrl.any_wq); break; =20=09=09 case TCS_LAYER: - BT_DRIVER("bt_connect_cfm [%s]\n", psmname(psm)); + BT_DRIVER(__FUNCTION__ ": [%s]\n", psmname(psm)); break; =20 default: - D_ERR("bt_connect_cfm : unknown layer %d\n", psm); + D_ERR(__FUNCTION__ ": Unknown layer %d\n", psm); break; } } @@ -2150,7 +2103,7 @@ { /* Check the line for validity */ if (line > BT_NBR_DATAPORTS) { - D_ERR("bt_connect_cfm on invalid line (%d)\n", line); + D_ERR(__FUNCTION__ ": Invalid line (%d)\n", line); return; } =20=09 @@ -2161,8 +2114,7 @@ /* If previous data, deallocate it */ =20 if (bt_ctrl.session[line].sdpRequestResponseData) { - D_WARN(__FUNCTION__": sdpRequestResponseData set - "\ - "deallocate\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; @@ -2237,10 +2189,10 @@ bt_disconnect_ind(u32 con_id)=20 { if (GET_PSM(con_id) =3D=3D RFCOMM_LAYER) - BT_DRIVER("bt_disconnect_ind : RFCOMM dlci : %d\n",=20 + BT_DRIVER(__FUNCTION__ ": RFCOMM dlci: %d\n",=20 GET_RFCOMMDLCI(con_id)); else - BT_DRIVER("bt_disconnect_ind : psm %d\n", GET_PSM(con_id)); + BT_DRIVER(__FUNCTION__ ": PSM %d\n", GET_PSM(con_id)); } =20 void @@ -2248,7 +2200,7 @@ { u32 line =3D GET_RFCOMMLINE(con_id); =20 - BT_DRIVER("bt_disconnect_cfm : psm %d, status %d\n",=20 + BT_DRIVER(__FUNCTION__ ": PSM %d, status %d\n",=20 GET_PSM(con_id), status); =20 bt_ctrl.session[line].disconnect_status =3D status; @@ -2263,7 +2215,7 @@ { struct tty_struct *upper_tty; =20 - BT_DRIVER("bt_hangupline : hanging up line %d\n", line); + BT_DRIVER(__FUNCTION__ ": Hanging up line %d\n", line); =20 /* find corresponding upper tty */ upper_tty =3D GET_UPPERTTY(line); @@ -2271,7 +2223,7 @@ if (upper_tty) tty_hangup(upper_tty); else - D_WARN("bt_hangupline : no upper tty\n"); + D_WARN(__FUNCTION__ ": No upper tty\n"); } =20 #ifdef __CRIS__ @@ -2328,7 +2280,7 @@ #endif =20 /**********************************/ -/* Bluetooth Stack Initialization */ +/* Bluetooth Stack Initialisation */ /**********************************/ =20 #if defined(MODULE) || defined(__KERNEL__) @@ -2345,7 +2297,7 @@ =20 bt_show_version(); =20 - /* Initialize the tty_driver structure */ + /* Initialise the tty_driver structure */ =20=09 memset(&bt_driver, 0, sizeof(bt_driver)); bt_driver.magic =3D BT_TTY_DRIVER_MAGIC; @@ -2390,9 +2342,9 @@ bt_driver.hangup =3D bt_hangup; =20=20=20 if (tty_register_driver(&bt_driver)) - panic("Couldn't register bluetooth driver\n"); + panic("Could not register bluetooth driver\n"); =20 - DSYS("Bluetooth driver registered in %s\n", bt_driver.name); + DSYS("Bluetooth driver registered as %s\n", bt_driver.name); =20 /* * Register the tty discipline @@ -2419,12 +2371,12 @@ if (status =3D=3D 0) { DSYS("Bluetooth line discipline registered.\n"); } else { - printk (KERN_ERR "error registering line discipline: %d\n", + printk (KERN_ERR "Error registering line discipline: %d\n", status); return status; } =20 - /* Initialize the tty_driver structure */ + /* Initialise the tty_driver structure */ bt_ctrl_init(); =20=09 sertty =3D NULL; @@ -2468,7 +2420,7 @@ #endif /* LINUX_VERSION_CODE */ =20 if (procfs_status < 0) { - D_ERR("Couldn't register proc file bt_internal_info %d\n", + D_ERR("Could not register proc file bt_internal_info %d\n", procfs_status); } =20 @@ -2488,7 +2440,7 @@ #endif /* LINUX_VERSION_CODE */ =20 if (procfs_status < 0) { - D_ERR("Couldn't register proc file bt_status %d\n",=20 + D_ERR("Could not register proc file bt_status %d\n",=20 procfs_status); } =20 @@ -2511,7 +2463,7 @@ #endif /* LINUX_VERSION_CODE */ =20 if (procfs_status < 0) { - D_ERR("Couldn't register proc file for tci database %d\n", + D_ERR("Could not register proc file for tci database %d\n", procfs_status); } #endif /* CONFIG_BLUETOOTH_USE_TCI */ @@ -2636,7 +2588,7 @@ if (!bt_dfu_mode(-1)) { /* Always check if hci succeeded */ if (hci_init() < 0){ - D_ERR("HCI failed to initialize\n"); + D_ERR("HCI failed to initialise\n"); goto init_failed_exit1; } =20=09 @@ -2670,10 +2622,8 @@ return 0; =20 init_failed_exit1:=20 - printk("init_failed_exit1\n"); hci_shutdown(); init_failed_exit0: - printk("init_failed_exit0\n"); btmem_shutdown(); if (tmp_bt_buf) { free_page((unsigned long) tmp_bt_buf); @@ -2695,19 +2645,19 @@ { /* check if this line was the one previously used */ if ((line !=3D tty_linebuf.line) && (tty_linebuf.line !=3D TTY_NOLINE)) { - D_ERR("Line %d not active and linebuf busy, silent discard...\n", line); + D_ERR(__FUNCTION__ ": Line %d not active and linebuf busy, silent discar= d...\n", line); return; } else if (tty_linebuf.line =3D=3D TTY_NOLINE) tty_linebuf.line =3D line; =20 /* is there room for data ? */ if ((tty_linebuf.cur_len + len) > TTY_LINEBUFLEN) { - D_ERR("Line %d not active and linebuf full, silent discard (consider inc= reasing line buffer [%d])\n", line, TTY_LINEBUFLEN); + D_ERR(__FUNCTION__ ": Line %d not active and linebuf full, silent discar= d (consider increasing line buffer [%d])\n", line, TTY_LINEBUFLEN); return; } =20=09 /* ok, add it ! */ - DSYS("bt_linebuf_add : adding %d bytes\n", len); + DSYS(__FUNCTION__ ": Adding %d bytes\n", len); memcpy(tty_linebuf.data+tty_linebuf.cur_len, data, len); tty_linebuf.cur_len +=3D len; } @@ -2720,14 +2670,14 @@ return; =20 if (upper_tty && tty_linebuf.cur_len > 0) { - DSYS("bt_linebuf_empty : now sending buffered data [%d] to line %d\n", t= ty_linebuf.cur_len, line); + DSYS(__FUNCTION__ ": Now sending buffered data [%d] to line %d\n", tty_l= inebuf.cur_len, line); =20 upper_tty->ldisc.receive_buf(upper_tty, tty_linebuf.data,=20 NULL, tty_linebuf.cur_len);=20=20 =20 bt_reset_linebuf(); } else - DSYS("bt_linebuf_empty : no data sent\n"); + DSYS(__FUNCTION__ ": No data sent\n"); } #endif /* BT_USELINEBUF */ =20 @@ -2735,7 +2685,7 @@ bt_ctrl_init(void) { s32 i; - BT_DRIVER("Initiating bt ctrl struct\n"); + BT_DRIVER("Initialising bt ctrl struct\n"); =20 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) for (i =3D 0; i < BT_NBR_PORTS; i++) { @@ -2825,7 +2775,7 @@ if ((SESSIONSTATE(line) =3D=3D BT_INACTIVE) ||=20 (SESSIONSTATE(line) =3D=3D BT_UPPERCONNECTED)) { /* now register ! */ - DSYS("bt_register_rfcomm : dlci %d on line %d\n", dlci, line); + DSYS(__FUNCTION__ ": dlci %d on line %d\n", dlci, line); =20=09=09 bt_ctrl.session[line].rfcomm =3D rfcomm;=20 bt_ctrl.session[line].dlci =3D dlci; @@ -2839,7 +2789,7 @@ } =20=09 if (!found) - D_WARN("bt_register_rfcomm : line %d busy [%s]\n",=20 + D_WARN(__FUNCTION__ ": Line %d busy [%s]\n",=20 line, statename(SESSIONSTATE(line))); return found; } @@ -2850,26 +2800,26 @@ s32 found =3D 0; =20 if (!bt_stack_initiated) { - D_WARN("bt_register_sdp : Bluetooth stack not initialized\n"); + D_WARN(__FUNCTION__ ": Bluetooth stack not initialised\n"); return -1;=09 } =20 /* Better not have any sdp data pending for this connection */ =20 if (bt_ctrl.session[line].sdpRequestResponseData) { - D_WARN("bt_register_sdp: Pending SDP data for this new connection @ line= %d\n", line); + D_WARN(__FUNCTION__ ": Pending SDP data for this new connection on line = %d\n", line); } =20 if (SESSIONSTATE(line) =3D=3D BT_INACTIVE) { /* now register ! */ - DSYS("bt_register_sdp : line %d\n", line); + DSYS(__FUNCTION__ ": Line %d\n", line); SESSIONSTATE(line) =3D BT_ACTIVE; bt_ctrl.session[line].sdpID =3D sdpID; found =3D 1; } =20 if (!found) - D_WARN("bt_register_sdp : could not find any available lines\n"); + D_WARN(__FUNCTION__ ": Could not find any available lines\n"); =20 return found; } @@ -2877,7 +2827,7 @@ s32 bt_unregister_rfcomm(s32 line) { - BT_DRIVER("bt_unregister_rfcomm : line %d\n", line);=09 + BT_DRIVER(__FUNCTION__ ": Line %d\n", line);=09 =20 if (SESSIONSTATE(line) =3D=3D BT_ACTIVE) { bt_ctrl.session[line].rfcomm =3D 0;=20 @@ -2892,7 +2842,7 @@ } else if (SESSIONSTATE(line) =3D=3D BT_LOWERCONNECTED) { bt_reset_session(line);=09=09 } else { - D_WARN("bt_unregister_rfcomm : inactive session\n"); + D_WARN(__FUNCTION__ ": Inactive session\n"); return -1; } =20 @@ -2905,10 +2855,10 @@ =20 s32 bt_unregister_sdp(s32 line) { - BT_DRIVER("bt_unregister_sdp : line %d\n", line);=09 + BT_DRIVER(__FUNCTION__ ": Line %d\n", line);=09 =20 if (!bt_stack_initiated) { - D_WARN("bt_unregister_sdp : Bluetooth stack not initialized\n"); + D_WARN(__FUNCTION__ ": Bluetooth stack not initialised\n"); return -1;=09 } =20 @@ -2916,7 +2866,7 @@ response data AND clear length and pointer */ =20 if (bt_ctrl.session[line].sdpRequestResponseData) { - DSYS("bt_unregister_sdp: Free request data 0x%x\n", + DSYS(__FUNCTION__ ": Free request data 0x%x\n", (unsigned int)bt_ctrl.session[line].sdpRequestResponseData); kfree(bt_ctrl.session[line].sdpRequestResponseData); bt_ctrl.session[line].sdpRequestResponseData =3D NULL; @@ -2949,7 +2899,7 @@ } else { /* Data line ! */ if (!bt_stack_initiated) { - D_WARN("bt_register_tty : Bluetooth stack not initiated\n"); + D_WARN(__FUNCTION__ ": Bluetooth stack not initialised\n"); return -EPERM; } } @@ -2973,7 +2923,7 @@ } return 0; } else { - D_WARN("bt_register_tty : line busy !\n"); + D_WARN(__FUNCTION__ ": Line busy !\n"); } return -EBUSY; } @@ -2991,7 +2941,7 @@ /* 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"); + BT_DRIVER(__FUNCTION__ ": Invalid pid\n"); return -1; } =20 @@ -3010,7 +2960,7 @@ NBR_UPPER--; } else { - D_WARN("bt_unregister_tty : tty not prev registered\n"); + D_WARN(__FUNCTION__ ": TTY not previously registered\n"); return -ENODEV; } return 0; /* Until the above is fixed */ @@ -3078,13 +3028,13 @@ { #if BT_PARANOIA_CHECK if (!bt_tty) { - printk("Warning: null tty_driver struct for (%s) in %s\n", + printk("Warning: Null tty_driver struct for (%s) in %s\n", kdevname(device), routine); return -EINVAL; } =20 if (bt_tty->magic !=3D BT_TTY_DRIVER_MAGIC) { - printk("Warning: bad magic number for bluetooth driver struct (%s) in %s= \n", kdevname(device), routine); + printk("Warning: Bad magic number for bluetooth driver struct (%s) in %s= \n", kdevname(device), routine); return -EINVAL; } #endif @@ -3122,7 +3072,7 @@ wq_timer->data =3D (unsigned long)wq; wq_timer->expires =3D jiffies + timeout; add_timer(wq_timer); -// printk("start_wq_timer wq 0x%x : timer 0x%x\n", wq, wq_timer); +// printk(__FUNCTION__ ": wq: 0x%x, timer: 0x%x\n", wq, wq_timer); } =20 =20 @@ -3131,7 +3081,7 @@ release_wq_timer(struct timer_list *wq_timer) { del_timer(wq_timer); -// printk("release_wq_timer timer 0x%x\n", wq_timer); +// printk(__FUNCTION__ ": timer: 0x%x\n", wq_timer); } =20 void @@ -3161,7 +3111,7 @@ save_flags(flags); cli(); if ((error =3D tty_unregister_driver(&bt_driver))) - printk("SERIAL: failed to unregister bluetooth driver (%d)\n", + printk("SERIAL: Failed to unregister bluetooth driver (%d)\n", error); restore_flags(flags); =20 |