Author Topic: Connection - Error 0x50041  (Read 29552 times)

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Connection - Error 0x50041
« Reply #15 on: June 30, 2021, 12:08:16 PM »
Yes, the problem may appear if the device uses the same MAC for LE and Classic connection. It may not work on Windows with some Bluetooth hardware.

You can pair from BluetoothManager demo and then try to connect from RfCommClient demo to make surtre the connection works.

Offline KCorazza

  • Newbie
  • *
  • Posts: 19
  • Karma: 0
Re: Connection - Error 0x50041
« Reply #16 on: June 30, 2021, 12:29:16 PM »
Please check the image in attach.

I wasn't able to pair anymore with error 50089 or error 50015. Suddendly I was able to Pair but look at the image, has been paired as BLE and this should not be.

Now if I try to unpair, it remains paired but no more with BLE but with Classic. A second unpair is necessary.

I don't know if this make sense or if this help you to understand the issue.

Thanks.

Keven Corazza



Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Connection - Error 0x50041
« Reply #17 on: June 30, 2021, 01:34:59 PM »
It looks like device uses the same MAC for BLE and classic. And only after pairing it switches to the other MAC.

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Connection - Error 0x50041
« Reply #18 on: June 30, 2021, 01:59:35 PM »
By the way, try to change Io Capabilities to iocapDisplayKeyboard.

Offline KCorazza

  • Newbie
  • *
  • Posts: 19
  • Karma: 0
Re: Connection - Error 0x50041
« Reply #19 on: June 30, 2021, 02:26:57 PM »
Hi,

I have modified the demo as follow:

Code: [Select]
        private void btUnpair_Click(object sender, EventArgs e)
        {
            m_BTClient.Disconnect();


            if (lvDevices.SelectedItems.Count == 0)
                MessageBox.Show("Select device", "Warning", MessageBoxButtons.OK,
                    MessageBoxIcon.Warning);
            else
            {
                ListViewItem Item = lvDevices.SelectedItems[0];
                wclBluetoothRadio Radio = (wclBluetoothRadio)Item.Tag;
                Int64 Address = Convert.ToInt64(Item.SubItems[1].Text, 16);

                Int32 Res = Radio.RemoteUnpair(Address);
                if (Res != wclErrors.WCL_E_SUCCESS)
                    ShowError(Res);

                RefreshDevice(Item);
            }
        }

        private void btPair_Click(object sender, EventArgs e)
        {
            if (lvDevices.SelectedItems.Count == 0)
                MessageBox.Show("Select device", "Warning", MessageBoxButtons.OK,
                    MessageBoxIcon.Warning);
            else
            {
                ListViewItem Item = lvDevices.SelectedItems[0];
                wclBluetoothRadio Radio = (wclBluetoothRadio)Item.Tag;
                Int64 Address = Convert.ToInt64(Item.SubItems[1].Text, 16);

                Int32 Res = Radio.RemotePair(Address);
                if (Res != wclErrors.WCL_E_SUCCESS)
                    ShowError(Res);
                else
                {
                    m_BTClient.Address = Address;
                    m_BTClient.Authentication = false;
                    m_BTClient.Encryption = false;
                    //m_BTClient.Timeout = 10;
                    m_BTClient.Channel = 11;
                    m_BTClient.Service = wclUUIDs.SerialPortServiceClass_UUID;

                    int iResult = m_BTClient.Connect(Radio);
                    if (iResult == wclErrors.WCL_E_SUCCESS)
                    {
                    }
                }
            }
        }

        private void BTClient_OnConnect(object Sender, int Error)
        {
            if (Error == wclErrors.WCL_E_SUCCESS)
            {
                MessageBox.Show("CONNECTED!", "Warning", MessageBoxButtons.OK,
                    MessageBoxIcon.Warning);
            }
            else
            {
                MessageBox.Show("ERROR: " + Error.ToString(), "Warning", MessageBoxButtons.OK,
                    MessageBoxIcon.Warning);
            }
        }



Looking at the behaviors:

* RemotePair: two pairing are done, one for Classic and one for LE
* Connect: it looks that connection on Classic is done but if you query the status GetRemoteConnectedStatus it return false because LE is checked.

Is it possible to have one single behavior by excluding LE ?

I am not able to make it working in a reliable and repetitive way. I really need an help on your side.

Thanks. Regards.

Keven Corazza

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Connection - Error 0x50041
« Reply #20 on: June 30, 2021, 02:33:50 PM »
Unfortunatel there is nothing we can do while device uses single MAC for classic and LE.

Offline KCorazza

  • Newbie
  • *
  • Posts: 19
  • Karma: 0
Re: Connection - Error 0x50041
« Reply #21 on: June 30, 2021, 03:14:28 PM »
I have followed your suggestion to set  Io Capabilities to iocapDisplayKeyboard.

It doesn't work but now I am not able to discover the device. Neither from your demo application.

Switched off and on, doesn't help.

Any idea if IoCapabilities changed something in the device ?

Thanks. Regards.

Keven Corazza



Offline KCorazza

  • Newbie
  • *
  • Posts: 19
  • Karma: 0
Re: Connection - Error 0x50041
« Reply #22 on: June 30, 2021, 03:30:17 PM »
It is my PC that is no more able to discover the device. I can do from other PCs but no more from this one.

Even after a restart...

Regards.

Keven Corazza

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Connection - Error 0x50041
« Reply #23 on: June 30, 2021, 06:55:34 PM »
Probably there is something with your Bluetooth adapter. IoCaps does nothing except selecting pairing methods.

Offline KCorazza

  • Newbie
  • *
  • Posts: 19
  • Karma: 0
Re: Connection - Error 0x50041
« Reply #24 on: July 01, 2021, 07:46:39 AM »
Good morning,

me again. I confirm that since the time that I tried to change IoCapabilities parameter, my PC is no more able to discover the BT device. Same application on another PC is able to discover the device.

Do you save some settings in some registry  ?
Why is this possible ?
How can I restore and return to the previous situation in which I was able to discover the device ?

Thank you in advance for your help.

Regards.

Keven Corazza


Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Connection - Error 0x50041
« Reply #25 on: July 01, 2021, 07:51:54 AM »
Hi,

Changing IoCap does nothing with registry as well as with any other settings. The IoCap affects only pairing methods fflags used in call to system Pair(). Nothing more.

probably you have third-party Bluetooth driver installed on this PC that blocks system calls (it is more or less common situation).

Offline KCorazza

  • Newbie
  • *
  • Posts: 19
  • Karma: 0
Re: Connection - Error 0x50041
« Reply #26 on: July 01, 2021, 07:58:48 AM »
Ok,

any suggestion on how to recover from this situation ? I am really blocked and I cannot use your library in this PC.

Thanks. Keven.


Offline KCorazza

  • Newbie
  • *
  • Posts: 19
  • Karma: 0
Re: Connection - Error 0x50041
« Reply #27 on: July 01, 2021, 08:00:05 AM »
By the way, BT adapter is integrated in the notebook, we are not talking about an external BT adapter with drivers and so on.

Thanks. Regards.

Keven.

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Connection - Error 0x50041
« Reply #28 on: July 01, 2021, 08:04:03 AM »
Any BT adapter requires driver (as any hardware does). Some vendors installs third-party Bluetooth driver extension. Some adapter (usually on Toshiba) uses 2-in-1 WiFi/BT modules that also requires filter driver.

Make sure there is no any third party Bluetooth drivers installed. Delete MS BT driver from Device Manager and let Windows reinstalls it.

Offline KCorazza

  • Newbie
  • *
  • Posts: 19
  • Karma: 0
Re: Connection - Error 0x50041
« Reply #29 on: July 01, 2021, 08:52:40 AM »
Sorry if I insist, but I have just installed another BT library (IPWorks Bluetooth 2020 .NET Edition Website  Support from nsSoftware) and it works. I am able to discover my device and connect.

I don't know where is the problem but it looks something related to your library.

I bought your library just two weeks ago and I would keep it and don't have to switch to another library.

Please let me know. Thanks.

Regards. Keven.

 

Sitemap 1 2 3 4 5 6 7