aboutsummaryrefslogtreecommitdiff
path: root/Demos/Host
diff options
context:
space:
mode:
authorDean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28>2010-04-12 13:42:35 +0000
committerDean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28>2010-04-12 13:42:35 +0000
commit3fb5f7ce74a20eb3516b4a1d7cc42ea917a49c5c (patch)
tree80357eb73d020c3684e167e007caeb4c3cb6fdcb /Demos/Host
parent9dfba5ee27739c6d75330d35e33032fd75666642 (diff)
Fix Bluetooth stack CONNECTION RESPONSE packets - for this command and this command only, the source/destination roles are switched. Reverse the Local/Remote channel ordering so that Windows mobile and other stacks which depend on valid channel values to connect.
git-svn-id: http://lufa-lib.googlecode.com/svn/trunk@1203 d5102386-fcda-11dd-9fdb-3debd5008f28
Diffstat (limited to 'Demos/Host')
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.c18
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.h3
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.h2
3 files changed, 18 insertions, 5 deletions
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.c b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.c
index 45fad7bd..449d57fb 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.c
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.c
@@ -141,6 +141,17 @@ static void Bluetooth_ProcessACLPackets(void)
case BT_SIGNAL_INFORMATION_REQUEST:
Bluetooth_Signal_InformationReq(&ACLPacketHeader, &DataHeader, &SignalCommandHeader);
break;
+ case BT_SIGNAL_COMMAND_REJECT:
+ BT_ACL_DEBUG(1, "<< Command Reject", NULL);
+
+ uint16_t RejectReason;
+ Pipe_Read_Stream_LE(&RejectReason, sizeof(RejectReason));
+ Pipe_Discard_Stream(ACLPacketHeader.DataLength - sizeof(RejectReason));
+ Pipe_ClearIN();
+ Pipe_Freeze();
+
+ BT_ACL_DEBUG(2, "-- Reason: %d", RejectReason);
+ break;
default:
BT_ACL_DEBUG(1, "<< Unknown Signaling Command 0x%02X", SignalCommandHeader.Code);
@@ -315,9 +326,10 @@ static inline void Bluetooth_Signal_ConnectionReq(BT_ACL_Header_t* ACLPac
ResponsePacket.SignalCommandHeader.Code = BT_SIGNAL_CONNECTION_RESPONSE;
ResponsePacket.SignalCommandHeader.Identifier = SignalCommandHeader->Identifier;
ResponsePacket.SignalCommandHeader.Length = sizeof(ResponsePacket.ConnectionResponse);
- ResponsePacket.ConnectionResponse.Result = (ChannelData == NULL) ? BT_CONNECTION_REFUSED_RESOURCES : BT_CONNECTION_SUCCESSFUL;
- ResponsePacket.ConnectionResponse.DestinationChannel = ChannelData->RemoteNumber;
- ResponsePacket.ConnectionResponse.SourceChannel = ChannelData->LocalNumber;
+ ResponsePacket.ConnectionResponse.DestinationChannel = ChannelData->LocalNumber;
+ ResponsePacket.ConnectionResponse.SourceChannel = ChannelData->RemoteNumber;
+ ResponsePacket.ConnectionResponse.Result = (ChannelData == NULL) ? BT_CONNECTION_REFUSED_RESOURCES :
+ BT_CONNECTION_SUCCESSFUL;
ResponsePacket.ConnectionResponse.Status = 0x00;
Bluetooth_SendPacket(&ResponsePacket, sizeof(ResponsePacket), NULL);
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.h b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.h
index 012fbc0f..d38721a7 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.h
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.h
@@ -42,13 +42,14 @@
/* Macros: */
#define BT_ACL_DEBUG(l, s, ...) do { if (ACL_DEBUG_LEVEL >= l) printf_P(PSTR("(ACL) " s "\r\n"), __VA_ARGS__); } while (0)
- #define ACL_DEBUG_LEVEL 1
+ #define ACL_DEBUG_LEVEL 2
#define BT_CHANNELNUMBER_BASEOFFSET 0x0040
#define BT_CHANNEL_SIGNALING 0x0001
#define BT_CHANNEL_CONNECTIONLESS 0x0002
+ #define BT_SIGNAL_COMMAND_REJECT 0x01
#define BT_SIGNAL_CONNECTION_REQUEST 0x02
#define BT_SIGNAL_CONNECTION_RESPONSE 0x03
#define BT_SIGNAL_CONFIGURATION_REQUEST 0x04
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.h b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.h
index 5ab7a6f9..fa30524a 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.h
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.h
@@ -41,7 +41,7 @@
#define BLUETOOTH_DATA_OUT_PIPE 2
#define BLUETOOTH_EVENTS_PIPE 3
- #define BLUETOOTH_MAX_OPEN_CHANNELS 2
+ #define BLUETOOTH_MAX_OPEN_CHANNELS 6
#define CHANNEL_PSM_SERVICEDISCOVERY 0x0001
#define CHANNEL_PSM_UDP 0x0002