<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Writing BT stack to connect with Wiimote - problems connecting</title>
<description>I&#039;m working on a project which intends to connect an embedded microprocessor (the host/master) to a Wiimote. I only have the Bluetooth HCI interface to work with (no L2CAP, HID). I&#039;m able to successfully complete an inquiry returning a Wiimote BD_ADDR (and other information). I am in effect compressing the L2CAP and HID protocols into a thin embedded implementation. I am stuck at establishing a connection (using only HCI calls). The reply (BT event) that is returned provides an error code indicating a page timeout. I&#039;ve checked to ensure my local controller (BT master) has authentication disabled. I have checked to be sure I have the correct BD_ADDR for my Wiimote. Any ideas about what additional setup is required before I attempt establishing a (raw - HCI level) connection to the Wiimote?

Thanks.

[edit] I tried connecting with the Wiimote in discoverable mode (pressing sync button under the back cover). I was able to establish a connection (Connection Complete event returns status 0x00), but it was immediately terminated (received a Disconnection Complete event).</description><link>http://forum.wiibrew.org/read.php?7,73034,73034#msg-73034</link><lastBuildDate>Fri, 12 Jun 2026 12:33:55 +0200</lastBuildDate>
<generator>Phorum 5.2.23</generator>
<item>
<guid>http://forum.wiibrew.org/read.php?7,73034,73109#msg-73109</guid>
<title>Re: Writing BT stack to connect with Wiimote - problems connecting</title><link>http://forum.wiibrew.org/read.php?7,73034,73109#msg-73109</link><description><![CDATA[ I have been successful in connecting to the wiimote with my "thin" BT stack. Thanks for all the help.<br /><br />I still don&#039;t understand why I cannot send an ACL packet with PB=02. But I&#039;m past that obstacle.]]></description>
<dc:creator>ags000</dc:creator>
<category>Hardware</category><pubDate>Mon, 24 Jun 2013 05:26:22 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?7,73034,73105#msg-73105</guid>
<title>Re: Writing BT stack to connect with Wiimote - problems connecting</title><link>http://forum.wiibrew.org/read.php?7,73034,73105#msg-73105</link><description><![CDATA[ Wow. Not what I expected.<br /><br />I tried setting the host buffer size to match the controller reported buffer sizes. This returned a success status.<br /><br />Then I tried issuing the same command to establish an L2CAP channel - and same symptoms: no response at all.<br /><br />In frustration (perhaps desperation) I decided to fiddle with the LLID bits. I&#039;m still confused by the description in the spec, which seems self-contradictory to me.<br /><br />As it turns out, if I issue the connection request (for an L2CAP channel) using PB of 00, I get a response! With PB=03 or 02, no response. This is really confusing. And, the response is sent with LLID = 20. I just don&#039;t understand this. (NOTE: to try to simplify, I&#039;m testing using a USB BT dongle on my desktop, not the wiimote).<br /><br />So once I send the (L2CAP) connection request (PSM==01), I receive an extended features request, then a configuration request (for MTU size). I do get a connection response with successful status. I wasn&#039;t prepared for all this traffic, so hadn&#039;t coded responses. Ultimately, the connection was terminated (reason==0x13, Remote User Terminated Connection).<br /><br />So I still can&#039;t figure out the proper use of LLID, but I have successfully created my first L2CAP channel.<br /><br />BTW, both the host and remote device report a version of 04, or BT 2.1 + EDR.<br /><br />Still don&#039;t understand the LLID flag.]]></description>
<dc:creator>ags000</dc:creator>
<category>Hardware</category><pubDate>Thu, 13 Jun 2013 07:43:07 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?7,73034,73101#msg-73101</guid>
<title>Re: Writing BT stack to connect with Wiimote - problems connecting</title><link>http://forum.wiibrew.org/read.php?7,73034,73101#msg-73101</link><description><![CDATA[ I will try. It occurred to me that the parameters may be a problem, but the behavior was to just not respond at all - as if the command was never sent. Surely a reasonable expectation would be for a Command Complete event with a non-success result code. With nothing to guide me, I couldn&#039;t even attempt to guess at what would be "reasonable" parameter values.<br /><br />With controller to host flow control disabled, wouldn&#039;t you expect the value of num_ACL_data_packets to be ignored and irrelevant? (I&#039;ll still try it, though). I did try values of 0 for both ACL data and synchronous data, thinking this would indicate unlimited buffers. It may be the buffer size that is the problem, even if 0 buffers is an acceptable parameter value.<br /><br />Is there any way to test behavior of a working wiimote interface - to see what happens if a connection (link) is established but no L2CAP channels are established for a minute? I still don&#039;t understand why the successful connection is disconnected (every time) just seconds after the connection is established.]]></description>
<dc:creator>ags000</dc:creator>
<category>Hardware</category><pubDate>Wed, 12 Jun 2013 22:15:58 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?7,73034,73100#msg-73100</guid>
<title>Re: Writing BT stack to connect with Wiimote - problems connecting</title><link>http://forum.wiibrew.org/read.php?7,73034,73100#msg-73100</link><description><![CDATA[ Try increasing the ACL packet length to at least 256 and num_acl_data_packets to 16. The synchronous data parameters shouldn&#039;t matter.]]></description>
<dc:creator>tueidj</dc:creator>
<category>Hardware</category><pubDate>Wed, 12 Jun 2013 20:41:34 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?7,73034,73099#msg-73099</guid>
<title>Re: Writing BT stack to connect with Wiimote - problems connecting</title><link>http://forum.wiibrew.org/read.php?7,73034,73099#msg-73099</link><description><![CDATA[ You may be onto something with setting the host buffer size. As I read the spec, it says that if not set, the controller will assume that it can send an unlimited number of data packets of any size it wants. Also, if controller-to-host flow control is not enabled (which is the default, and I am not enabling it) the number of packets is not used anyway. However, I&#039;m more interested in making this work than interpreting the spec...<br /><br />When I tried to set the host buffer size with the Host Buffer Size command, there was no response. It was as though the command I was sending was incorrect. Eventually, after sending other commands, I finally got a Hardware Error Event. This is what I sent to the controller:<br /><br />01 330C 07 4000 20 0100 0100<br /><br />Which I believe indicates:<br /><br />UART HCI command; Host Buffer Size command opcode; parameter length; 64 bytes ACL data buffer size; 32 bytes synchronous data buffer size; 1 ACL data buffer; 1 synchronous data buffer<br /><br />Is there something wrong with this? Some improper setting (or understanding on my part) may be why the controller never sends ACL data to the host.]]></description>
<dc:creator>ags000</dc:creator>
<category>Hardware</category><pubDate>Wed, 12 Jun 2013 16:54:03 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?7,73034,73090#msg-73090</guid>
<title>Re: Writing BT stack to connect with Wiimote - problems connecting</title><link>http://forum.wiibrew.org/read.php?7,73034,73090#msg-73090</link><description><![CDATA[ A basic init sequence is:<br />- hci_reset<br />- hci_read_buffer_size<br />- hci_read_bd_addr<br />- hci_host_buffer_size<br />- hci_write_pin_type(0 = variable)<br />- hci_write_page_timeout<br />- hci_write_scan_enable(2 = page scanning enabled)<br />Additional optional commands (things the wiimote doesn&#039;t care about but are good practice):<br />- hci_write_cod<br />- hci_change_local_name<br /><br /><br />"The event code 0xFF is reserved for the event code used for vendor-specific debug events." Manufacturer specific stuff, for example the wii uses it to signal when the red sync button on the front panel has been pressed.]]></description>
<dc:creator>tueidj</dc:creator>
<category>Hardware</category><pubDate>Tue, 11 Jun 2013 23:06:56 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?7,73034,73089#msg-73089</guid>
<title>Re: Writing BT stack to connect with Wiimote - problems connecting</title><link>http://forum.wiibrew.org/read.php?7,73034,73089#msg-73089</link><description><![CDATA[ I do not use any of these commands. As a matter of fact, I do nothing to initialize the local controller, other than issuing a Reset Command. If there are critical initialization steps please point me towards them. I note from the spec regarding the Read Buffer Size Command:<br /><br /><blockquote class="bbcode"><div><small>Quote<br /></small><strong></strong><br />The Read_Buffer_Size command must be issued by the Host before it sends any data to the Controller.</div></blockquote><br />I can see this is good practice, but will violating it cause a problem? Since the data packets from the wiimote are so small, I was simply going to use buffers sized for the MTU size (48 bytes). I presume there would only be an issue if I attempted to send a data packet larger than the controller&#039;s buffer size. I will test it later just to be sure.<br /><br />I also noted that upon power-up of the local controller (but not on reset) an event packet is sent by the controller. I presume this is some manufacturer-specific information (I will contact the manufacturer to verify) - have you heard of such a thing? I don&#039;t recognize the event code 0xFF. The byte sequence is:<br /><br />04FF1FC302000F000D000010000037000100004E0100000000000000000000000000]]></description>
<dc:creator>ags000</dc:creator>
<category>Hardware</category><pubDate>Tue, 11 Jun 2013 22:02:55 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?7,73034,73088#msg-73088</guid>
<title>Re: Writing BT stack to connect with Wiimote - problems connecting</title><link>http://forum.wiibrew.org/read.php?7,73034,73088#msg-73088</link><description><![CDATA[ Do you use the HCI_read_buffer_size and HCI_host_buffer_size commands as part of the controller initialization? Is flow control left off (by default) or explicitly enabled?]]></description>
<dc:creator>tueidj</dc:creator>
<category>Hardware</category><pubDate>Tue, 11 Jun 2013 21:04:17 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?7,73034,73087#msg-73087</guid>
<title>Re: Writing BT stack to connect with Wiimote - problems connecting</title><link>http://forum.wiibrew.org/read.php?7,73034,73087#msg-73087</link><description><![CDATA[ That&#039;s what I was testing when I started using the BT dongle instead of the wiimote.<br /><br />I was able to send ACL data (based on the "Number of Completed Packets Event" received) with the BT dongle. However, I never received any ACL data (there was never an acknowledgement of the connection request). This is how I got into the LLID and BT version issue. I observed that if I use the LLID (PB flag) of 11 (which appears to be correct for v4.0 but not v1.2 as you point out) with the BT dongle (which is v4.0) then I receive the "Number of Completed Packets Event" (but still no acknowledgment of the connection request). If I use the LLID (PB flag) of 0b10 (which is valid for v1.2 but not v4.0) then I get neither the "Number of Completed Packets Event" nor an acknowledgment of the connection request from the BT dongle.<br /><br />My hypothesis is that with the BT dongle (v4.0) and an LLID/PB value of 0b11, that represents a complete L2CAP PDU and it is forwarded on by the remote controller (in this case as a signaling command on (fixed) channel 1). That is why I receive the "Number of Completed Packets Event". When I use the LLID/PB value of 0b10, that is a start packet, and the local controller is waiting for the continuation packet. While that may be plausible, that would imply that there is not backwards compatibility, which I find unusual. Also, while I&#039;m clearly not an expert, it seems that the controller could easily recognize an L2CAP B-frame (complete L2CAP PDU) and know that the packet is complete. (if I understand correctly).<br /><br />This is why I started wondering if there is some flow control setting (on my host controller - not the BT dongle or the wiimote) that is interfering with reception of the ACL data. Since I&#039;m using a UART HCI transport, I only have RX and TX lines, and the RX path through my UART is working because that&#039;s the path to receive events from the controller.<br /><br />Is it possible to validate that the wiimote will maintain a connection (link) with another BT device even if no L2CAP channel is established within some timeout period? I am only seeing the disconnect when using the wiimote, not the BT dongle. (but still, I can&#039;t establish an L2CAP channel on either)]]></description>
<dc:creator>ags000</dc:creator>
<category>Hardware</category><pubDate>Tue, 11 Jun 2013 19:31:53 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?7,73034,73086#msg-73086</guid>
<title>Re: Writing BT stack to connect with Wiimote - problems connecting</title><link>http://forum.wiibrew.org/read.php?7,73034,73086#msg-73086</link><description><![CDATA[ Have you tested sending/receiving ACL data when connected to something other than a wiimote? Nearly every device supports SDP, for example.]]></description>
<dc:creator>tueidj</dc:creator>
<category>Hardware</category><pubDate>Tue, 11 Jun 2013 18:32:53 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?7,73034,73085#msg-73085</guid>
<title>Re: Writing BT stack to connect with Wiimote - problems connecting</title><link>http://forum.wiibrew.org/read.php?7,73034,73085#msg-73085</link><description><![CDATA[ I swapped out the troublesome wiimote for another one. I am now back to where I started: I am able to inquire and connect to the (different) wiimote - but it disconnects almost immediately. (Error code==0x16 "Connection Terminated by Local Host")<br /><br />I&#039;m using the exact sequence to establish the L2CAP channel as in the log you provided (with the exception that the connection handle is different). I&#039;m using:<br /><br /><br />02 2A20 0C00 0800 0100 02 01 0400 1100 4300<br /><br />HCI trasport - ACL data<br />Connection handle 0x002A, PB 0b10, BC 0b00<br />Packet length 0x000C<br />L2CAP header - length 0x0008<br />L2CAP header - channelID 0x0001 (signaling channel)<br />signal command 0x02 (connection request)<br />id 0x01<br />data length 0x0004<br />PSM 0x0011<br />source channel ID 0x0043<br /><br />Is is possible to conduct an experiment with a working wiimote connection? I&#039;m wondering if the wiimote behaves differently (than the BT dongle I was using) in that it will accept a connection but will drop that connection if the HID channels (PSM 11 and 13) are not established within a timeout period. I could understand this behavior since in normal operation the wiimote is always using those channels and does not need to support any others (although from the log I can see it also supports PSM 1 for SDP). (The BT dongle accepted a connection and it was not dropped even though I did not establish any L2CAP channels) I&#039;m trying to break this down into smaller pieces and look for a way to understand what is happening.<br /><br />I have never received any ACL data. When experimenting with the USB dongle on my desktop, I did receive a Number of Competed Packets event when I sent ACL data to that device (attempting to establish an L2CAP connection but never ACL data back with the connection response.<br /><br />Is there something that can be interfering with receipt of ACL data? I was wondering if flow control may be an issue.]]></description>
<dc:creator>ags000</dc:creator>
<category>Hardware</category><pubDate>Tue, 11 Jun 2013 17:27:42 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?7,73034,73078#msg-73078</guid>
<title>Re: Writing BT stack to connect with Wiimote - problems connecting</title><link>http://forum.wiibrew.org/read.php?7,73034,73078#msg-73078</link><description><![CDATA[ The versions don&#039;t matter.<br />The only thing I can think of that might help is to set the page scan type (HCI_Write_Page_Scan_Type) to 1.]]></description>
<dc:creator>tueidj</dc:creator>
<category>Hardware</category><pubDate>Tue, 11 Jun 2013 11:01:03 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?7,73034,73077#msg-73077</guid>
<title>Re: Writing BT stack to connect with Wiimote - problems connecting</title><link>http://forum.wiibrew.org/read.php?7,73034,73077#msg-73077</link><description><![CDATA[ No joy today. I thought the log would help. I was unable to even connect to the wiimote. Using the same BT module and interface that I&#039;m using to attempt connecting to the wiimote (but failing), I was able to connect to a USB BT dongle on my desktop. The only differences I can see are that the USB BT dongle reports LMP v4 (EDR2.1+) but the wiimote is LMP v2 (v1.2). The error status returned with the failed connection attempt to the wiimote is 0x04 - "Page Timeout". I set the BT module page timeout to 0x8000 (~20 seconds) but that did not help. I am putting the wiimote into discoverable mode (the leds flashing) using the sync button underneath the battery cover.<br /><br />I am able to inquire and find the wiimote (reports back the BD_ADDR)<br />I am not able to read the wiimote (remote) name (returns error code 0x04 - "Page Timeout")<br /><br />Is there something I need to do to make a v4 radio talk to a v2 radio?]]></description>
<dc:creator>ags000</dc:creator>
<category>Hardware</category><pubDate>Tue, 11 Jun 2013 08:18:41 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?7,73034,73076#msg-73076</guid>
<title>Re: Writing BT stack to connect with Wiimote - problems connecting</title><link>http://forum.wiibrew.org/read.php?7,73034,73076#msg-73076</link><description><![CDATA[ The CIDs aren&#039;t important, the wii&#039;s software just counts upwards and this was the second time a wiimote had been synched since the game started.<br />Both of "in MTU" values are translated wrong, there&#039;s another one further down (0xB900).]]></description>
<dc:creator>tueidj</dc:creator>
<category>Hardware</category><pubDate>Tue, 11 Jun 2013 04:57:44 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?7,73034,73074#msg-73074</guid>
<title>Re: Writing BT stack to connect with Wiimote - problems connecting</title><link>http://forum.wiibrew.org/read.php?7,73034,73074#msg-73074</link><description><![CDATA[ Thanks for the log. That will probably get me back on track.<br /><br />1) This is the 3rd time I&#039;ve noticed someone using local CID=0x43 when opening the first L2CAP channel. Am I mistaken that the first dynamic (non-fixed, non-assigned) CID available is 0x40? (or is it just a coincidence?)<br /><br />2) Just checking: is there a typo in the text description for the line below (the MTU=256, not 1)?<br /><br />L2CAP config request: DCID 0x0044, 0, in MTU=1, out flushto=65535<br />DATA_OUT(18): 0b 20 14 00 10 00 01 00 04 02 0c 00 44 00 00 00 01 02 <u>00 01</u> 02 02 ff ff<br /><br />Thanks again - I&#039;ll report back on progress.]]></description>
<dc:creator>ags000</dc:creator>
<category>Hardware</category><pubDate>Tue, 11 Jun 2013 00:41:10 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?7,73034,73072#msg-73072</guid>
<title>Re: Writing BT stack to connect with Wiimote - problems connecting</title><link>http://forum.wiibrew.org/read.php?7,73034,73072#msg-73072</link><description><![CDATA[ The wiimote only supports BT Core Spec 1.2 (Read Remote Version Information returns LMP v2) which defines 0b11 as "Reserved for future use". As I said, use 0b10 for the first packet and 0b01 for any additional packets if they&#039;re needed (which won&#039;t happen if all your packets are smaller than the MTU).<br />It might help to view logs of bluetooth data between a wii and a wiimote. Here&#039;s a log from a game performing device discovery, connection, authentication, HID connection establishment and traffic etc.:<br />[<a href="http://www.tueidj.net/wiimote_sync.log" rel="nofollow">www.tueidj.net</a>]<br />CTRL_* corresponds to HCI commands, DATA_* is HCI ACL data. Flow direction is from the host&#039;s (the wii) point of view. Note that all the "Read Remote Version", "Read Remote Clock Offset" commands and SDP queries aren&#039;t necessary, the wii only does them to be sure it&#039;s talking to a wiimote.]]></description>
<dc:creator>tueidj</dc:creator>
<category>Hardware</category><pubDate>Mon, 10 Jun 2013 22:12:16 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?7,73034,73071#msg-73071</guid>
<title>Re: Writing BT stack to connect with Wiimote - problems connecting</title><link>http://forum.wiibrew.org/read.php?7,73034,73071#msg-73071</link><description><![CDATA[ I should probably also point out that based on my reading and understanding of the BT full specification, I&#039;m assuming that I can assign any channel ID (CID) I want which is &gt;0x3F (the top of the fixed/reserved CID space). I picked CID==0x40 when I setup a new connection. (I see there is a "Create Channel" command, but that appears to only be valid with AMP controllers. I hope I am correct here.) I&#039;m not doing anything to setup this channel, other than specifying that numeric value as the source CID when I establish a connection (for PSM == 0x11 in my testing).<br /><br />In other words, my understanding is that basically a channel (identified by the CID) must declare a PSM. Only one PSM is associated with any channel. The ACL data packet (for BR/EDR controllers) always contains an L2CAP packet; an L2CAP packet header specifies the length and CID, which in turn is associated with exactly one PSM, which enables the appropriate interpretation/routing of the contents to the proper protocol at the destination.<br /><br />Is this basically correct?]]></description>
<dc:creator>ags000</dc:creator>
<category>Hardware</category><pubDate>Mon, 10 Jun 2013 20:32:22 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?7,73034,73070#msg-73070</guid>
<title>Re: Writing BT stack to connect with Wiimote - problems connecting</title><link>http://forum.wiibrew.org/read.php?7,73034,73070#msg-73070</link><description><![CDATA[ [I suspect that I am missing some fundamental understanding of the packet structure here - perhaps the distinction between PB flag and LLID?]<br /><br />I had (am having) trouble understanding this flag. When I read the spec I took note of what I found to be conflicting information (BT Core Spec v4, Volume 2 Part E section 5.4.2: "HCI ACL Data Packets"). My plan is to implement a very rudimentary, purpose-built stack to support the wiimote (only). Since the reports from the wiimote maximum size is 21 bytes, I plan to have all packets less than the minimum allowable MTU size of 48 bytes. With this in mind, there would be no L2CAP fragmented packets - every packet would be complete. This is what I thought the "0b11" value was to represent.<br /><br />However, I found a small L2CAP embedded implementation (remote/client side, not host side) that appeared to use the "0b10" value for all packets. Inline comments explicitly stated that fragmented packets would not be supported.<br /><br />Finally, the NOTE in the specification (see below) seems to be in complete conflict with the information in the table immediately above it (table does not render here so I&#039;ve included the relevant columns/rows below also). Perhaps I&#039;m confusing the LLID with the PB? Where is the LLID if not in the PB flag?<br /><br />I tried modifying the byte stream to use the "0b10" PB value, but then instead of getting a "Number of Completed Packets" event, there was no response at all. Do I need to follow the "0b10" packet with another empty packet with PB==0b01?<br /><br />--- From the spec ----<br /><br />Packet_Boundary_Flag: Size: 2 Bits<br /><br />Value: 00<br />Parameter Description: First non-automatically-flushable packet of Higher Layer Message (start of a non-automatically-flushable L2CAP PDU) from Host to Controller.<br />Host to Controller: Allowed<br />Controller to Host: Not allowed (except during loop-back)<br /><br />Value: 01<br />Parameter Description: Continuing fragment of Higher Layer Message<br />Host to Controller: Allowed<br />Controller to Host: Allowed<br /><br />Value: 10<br />Parameter Description: First automatically-flushable packet of Higher Layer Message (start of an automatically-flushable L2CAP PDU).<br />Host to Controller: Allowed<br />Controller to Host: Allowed<br /><br />Value: 11<br />Parameter Description: A complete L2CAP PDU. Automatically flushable.<br />Host to Controller: Allowed<br />Controller to Host: Not Allowed<br /><br />NOTE: The start of a non-flushable packet of a Higher Layer Message (start of a non-automatically-flushable L2CAP PDU) with the PBF of 00 shall be transmitted with an LLID of 10. All continuing fragment packets of a Higher Layer Message shall be transmitted with an LLID of 01.]]></description>
<dc:creator>ags000</dc:creator>
<category>Hardware</category><pubDate>Mon, 10 Jun 2013 18:52:01 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?7,73034,73069#msg-73069</guid>
<title>Re: Writing BT stack to connect with Wiimote - problems connecting</title><link>http://forum.wiibrew.org/read.php?7,73034,73069#msg-73069</link><description><![CDATA[ 0b11 is an invalid value for the packet boundary flag. The first packet in a segment should use 0b10 and any following packets should use 0b01.]]></description>
<dc:creator>tueidj</dc:creator>
<category>Hardware</category><pubDate>Mon, 10 Jun 2013 16:15:44 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?7,73034,73063#msg-73063</guid>
<title>Re: Writing BT stack to connect with Wiimote - problems connecting</title><link>http://forum.wiibrew.org/read.php?7,73034,73063#msg-73063</link><description><![CDATA[ I&#039;ve been experimenting with a connection to a BT dongle on a desktop (using Bluesoleil stack) in an attempt to isolate mistakes I may be making misusing the HCI interface from any specific differences present when attempting to interface to the wiimote.<br /><br />Once I get a sequence of commands that work on the desktop I&#039;ll code it to run without delay and see how it works with the wiimote.<br /><br />I&#039;m currently stuck trying to open PSM 11 and 13 for the HID interface (using the connection to the desktop). There is probably something basic I&#039;m missing. I&#039;m able to connect, and verify the that link quality is good (0xFF) - but cannot open channels for the HID interface. I&#039;m sending ACL data to the L2CAP signal channel (0x0001) and instead of receiving a Connection Response, I am just getting a Number of Completed Packets event. It is as though the ACL data is being accepted, but is not recognized and/or interpreted as a valid L2CAP packet by the remote controller.<br /><br />Specifically, here&#039;s the byte sequence I&#039;m sending for an Echo Request after establishing a connection to the remote controller:<br /><br />02 2A30 0800 0400 0100 08 01 0000<br /><br />Which is:<br /><br />02: UART HCI transport header - ACL data<br />2A30: connection handle 02A (bits 0-11) - little endian order) of the ACL-U link (returned by the HCI connect command) and PB flag==0b11 (bits 12,13), BC flag == 0b00 (bits 14,15).<br />0800: length of ACL payload (little endian representation of 0008)<br />0400: L2CAP header length (little endian representation of 0004)<br />0100: L2CAP CID for the signaling channel (little endian representation of 0001)<br />08: L2CAP code - Echo Request<br />01: L2CAP Identifier<br />0000: Data Length<br /><br />Can anyone see what I&#039;m doing wrong here?]]></description>
<dc:creator>ags000</dc:creator>
<category>Hardware</category><pubDate>Mon, 10 Jun 2013 06:28:00 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?7,73034,73062#msg-73062</guid>
<title>Re: Writing BT stack to connect with Wiimote - problems connecting</title><link>http://forum.wiibrew.org/read.php?7,73034,73062#msg-73062</link><description><![CDATA[ The next step is connecting the HID L2CAP channels but you said it disconnects immediately... maybe you waited too long to connect after putting the wiimote into discoverable mode.]]></description>
<dc:creator>tueidj</dc:creator>
<category>Hardware</category><pubDate>Mon, 10 Jun 2013 05:58:20 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?7,73034,73058#msg-73058</guid>
<title>Re: Writing BT stack to connect with Wiimote - problems connecting</title><link>http://forum.wiibrew.org/read.php?7,73034,73058#msg-73058</link><description><![CDATA[ More results: Using the same BT controller I was able to use the same sequence of HCI commands and establish a BT connection to a laptop, without having the connection terminated. So it seems there is some next step after establishing the initial connection (ACL link) that the wiimote requires to prevent the connection from being dropped. Any ideas about what this might be would be are appreciated.]]></description>
<dc:creator>ags000</dc:creator>
<category>Hardware</category><pubDate>Sun, 09 Jun 2013 18:37:08 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?7,73034,73050#msg-73050</guid>
<title>Re: Writing BT stack to connect with Wiimote - problems connecting</title><link>http://forum.wiibrew.org/read.php?7,73034,73050#msg-73050</link><description><![CDATA[ I was able to look at the log including the reason code for the disconnect, when I was able (briefly) to connect to the wiimote when in discovery mode. The reason code is 0x16, "Connection terminated by local host". I didn&#039;t issue any command other than the connect command, so I&#039;m stumped as to why the wiimote reports this. I&#039;ve been able to reproduce this behavior consistently. I observe a delay between the time the Connection Complete Event returns Success Status and the Disconnection Complete Event - as though there is some further acknowledgement expected from the local controller (not the wiimote) to finalize the connection.]]></description>
<dc:creator>ags000</dc:creator>
<category>Hardware</category><pubDate>Sat, 08 Jun 2013 06:22:43 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?7,73034,73048#msg-73048</guid>
<title>Re: Writing BT stack to connect with Wiimote - problems connecting</title><link>http://forum.wiibrew.org/read.php?7,73034,73048#msg-73048</link><description><![CDATA[ Once you get the wiimote connected (by activating discovery mode using the sync button) you can do an authentication request. The wiimote will send a link key request, answer with a negative reply and it will request a pin (note that you should set the pin type to variable before this), send the wiimote&#039;s BD_ADDR as the pin code and authentication should complete. Then open the wiimote&#039;s control and data L2CAP channels and it will be permanently linked, pressing any button when it is "off" will cause it to initiate a connection to your host device.]]></description>
<dc:creator>tueidj</dc:creator>
<category>Hardware</category><pubDate>Sat, 08 Jun 2013 03:00:49 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?7,73034,73046#msg-73046</guid>
<title>Re: Writing BT stack to connect with Wiimote - problems connecting</title><link>http://forum.wiibrew.org/read.php?7,73034,73046#msg-73046</link><description><![CDATA[ I will have to get to another machine to read the log including the reason for the disconnection.<br /><br />I may need to rethink my project/design. I did not realize that even if I know the BD_ADDR of the wiimote it still needs to be discoverable before a connection can be established. I&#039;ve read and re-read the WiiBrew/Wiimote page many times and didn&#039;t understand that. Is this true if the wiimote is bonded to the host?<br /><br />Is there an alternative design that you can explain? Such as have the wiimote initiate the connection (how? does it first need to be bonded with the BT host before that will work?) and then (presumably) the wiimote requests a role change so the host acts as master?<br /><br />Thanks for following up on this.]]></description>
<dc:creator>ags000</dc:creator>
<category>Hardware</category><pubDate>Fri, 07 Jun 2013 21:36:23 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?7,73034,73043#msg-73043</guid>
<title>Re: Writing BT stack to connect with Wiimote - problems connecting</title><link>http://forum.wiibrew.org/read.php?7,73034,73043#msg-73043</link><description><![CDATA[ Yes the wiimote must be discoverable - that&#039;s the only time it will have page scanning enabled (which is how a device "hears" incoming connections) since the normal behavior is for the wiimote to initiate the connection rather than the wii.<br />What was the disconnection reason given by the wiimote?]]></description>
<dc:creator>tueidj</dc:creator>
<category>Hardware</category><pubDate>Fri, 07 Jun 2013 19:27:17 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?7,73034,73040#msg-73040</guid>
<title>Re: Writing BT stack to connect with Wiimote - problems connecting</title><link>http://forum.wiibrew.org/read.php?7,73034,73040#msg-73040</link><description><![CDATA[ I want to be sure I understand correctly: I fully agree that the Wiimote must be discoverable if it is to respond to inquiries from the master. However, my understanding is that once the inquiry is complete, a connection can be established without the Wiimote being discoverable (since the inquiry response provides the Wiimote&#039;s BD_ADDR). I think you are saying the opposite - that the Wiimote must be discoverable when the connection request is sent from the master. Is that correct?<br /><br />I did try connecting with the Wiimote discoverable, and a connection was established, but immediately terminated (by the Wiimote).]]></description>
<dc:creator>ags000</dc:creator>
<category>Hardware</category><pubDate>Fri, 07 Jun 2013 17:00:42 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?7,73034,73039#msg-73039</guid>
<title>Re: Writing BT stack to connect with Wiimote - problems connecting</title><link>http://forum.wiibrew.org/read.php?7,73034,73039#msg-73039</link><description><![CDATA[ By "psm" I meant page scan mode, which has been deprecated in later versions of the specification (replaced by the "reserved" parameter).<br /><br />From experience 0x0018 (DM1+DH1) definitely works for the packet type, R1 should be used as the page scan repetition mode, clock offset can be copied from the inquiry result with clock_offset_valid set or just leave it unset (that&#039;s what nintendo does). Role switching should be enabled, although the wiimote won&#039;t request a role switch in this situation.<br /><br />The wiimote definitely must be in discoverable mode otherwise it won&#039;t respond to pages, preventing any incoming connections. Once you get the connection complete event it should just wait for L2CAP comms (the LEDs stay flashing until told to do something else).]]></description>
<dc:creator>tueidj</dc:creator>
<category>Hardware</category><pubDate>Fri, 07 Jun 2013 10:33:17 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?7,73034,73038#msg-73038</guid>
<title>Re: Writing BT stack to connect with Wiimote - problems connecting</title><link>http://forum.wiibrew.org/read.php?7,73034,73038#msg-73038</link><description><![CDATA[ I&#039;m using the HCI_Create_Connection command. The parameters are:<br /><br />BD_ADDR, Packet_Type, Page_Scan_Repetition_Mode, Reserved, Clock_Offset, Allow_Role_Switch<br /><br />The BD_ADDR was returned in the inquiry result.<br />I tried packet types NULL (should default to DM1 per the spec), DM1, all legal (per EDR 2.1+ spec) types (DM1,3,5 and DH1,3,5) and even 0xFF just for kicks (it was rejected as an illegal parameter).<br />I used page scan repetition mode "R1"<br />I tried using the clock offset returned in the inquiry result, as well as NULL (so the clock_offset_valid_flag bit was cleared).<br />I do not enable role switching.<br /><br />At this level, I&#039;m not aware of any way to specify the PSM, as that is L2CAP, above HCI.<br /><br />I presume either I am using wrong values (for the Wiimote) or there is some other setup that has to happen before I attempt to connect. I have checked the host controller configuration and verified that authorization is not required. I have not taken any other steps for configuration other than the inquiry to get the Wiimote BD_ADDR.<br /><br />Thanks for any info you can share.]]></description>
<dc:creator>ags000</dc:creator>
<category>Hardware</category><pubDate>Thu, 06 Jun 2013 23:44:26 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?7,73034,73036#msg-73036</guid>
<title>Re: Writing BT stack to connect with Wiimote - problems connecting</title><link>http://forum.wiibrew.org/read.php?7,73034,73036#msg-73036</link><description><![CDATA[ What are the link control parameters (packet types, psrm, psm, role switch allowed...) being used to establish the connection?]]></description>
<dc:creator>tueidj</dc:creator>
<category>Hardware</category><pubDate>Thu, 06 Jun 2013 14:28:47 +0200</pubDate></item>
</channel>
</rss>