How to find it out BLE device is got unpair and connect it again - bluez

In bluez5.50, after connection establishment has done if I unpair a device and again put in discovery mode it's not able to connect(expected behavior ). But I want to connect BLE device to same running stack.
hcidump also showing the same event while BLE device goes to sleep mode or while got unpair form device side.
HCI Event: Disconn Complete (0x05) plen 4
status 0x00 handle 69 reason 0x16
Reason: Connection Terminated by Local Host
So not able to find it out which event exactly occur (sleep/unpair). can someone provide me solution how to find it out unpair event and try to connect it again?

What are you using for your connection pairing? Can you try doing this over bluetoothctl as follows:-
#bluetoothctl
[bluetoothctl]scan on #Scan for a few seconds until you find your device
[bluetoothctl]scan off #Stop scanning once you have found your device
[bluetoothctl]connect 00:11:22:33:44:55
[bluetoothctl]pair 00:11:22:33:44:55
[bluetoothctl]disconnect 00:11:22:33:44:55
[bluetoothctl]remove 00:11:22:33:44:55 # This is if you want to forget the device.
[bluetoothctl]scan on #Scan for a few seconds until you find your device
[bluetoothctl]scan off #Stop scanning once you have found your device
[bluetoothctl]connect 00:11:22:33:44:55
If this doesn't work, try and use btmon in another terminal and see why the connection is failing.
I hope this helps.

Related

How to determine on which Root Hub Port is connected a usb device after an Enable Slot Command with the Intel's xHC?

I am writing a small driver for the Intel's xHC in a small hobby OS I boot with UEFI.
After I reset all Root Hub Ports, I get 2 Port Status Change Events which is because I asked QEMU to emulate a usb keyboard and a usb mouse in the command line. One Port Status Change Event for each device seems fair. After this, I follow the initialization steps for a USB device. As stated in the xHCI spec:
After the port successfully reaches the Enabled state, system software shall obtain a Device Slot for the newly attached device using an Enable Slot Command, as described in section 4.3.2.
I thus send an Enable Slot Command to each Root Hub Port for which there was a Port Status Change Event. This seems to work because I get 2 Command Completion Events on the Event Ring which both trigger an interrupt. Both of these events are marked with a completion code of 1 which indicates success.
My problem starts here. In the Port Status Change Event is a Port ID field which allows to determine which port triggered the event. In the Command Completion Event, there is none of that. I can link to the Command TRB which triggered the event but the Command TRB doesn't include the Port ID. My problem is that after an Enable Slot Command I need to create an Input Context including a Slot Context which should contain the Root Hub Port number.
I could keep a list of the ports to which I sent an Enable Slot Command but that opens up to race conditions especially once multiprocessing is enabled.
How do I properly get which Root Hub Port triggered the Command Completion Event?
A similar question has been asked on the linux-usb maillist.
There, Mathias Nyman, points out that the Enable Slot is misleading because it doesn't enable the slot of a specific port instead the command just returns a free index in the Device Context Base Address Array.
This index is the Slot ID value.
The programmer has to set the corresponding entry (i.e. dev_ctx_base_addr[slot_id]) with a pointer to a Device Context structure and fill its Slot Context with whatever Port Number and Route String they deem appropriate.
It's important to stress out that there is no a priori relationship between the Slot ID and the Port Number/Route String.
So you can just have a queue of slots to initialize and dequeue them as the Command Completion Events arrive.

Facing issue to connect with GPSD with UART

We connected L89 GNSS module to processor via UART. I may running gpsmon and gpspipe commands on board but but not getting NMEA logs. But when we were connected L89 to processor via USB, that time I am getting NMEA logs on gpsmon and gpspipe, what is issue with UART?
I edit /etc/default/gpsd file.
# Default settings for gpsd.
# Please do not edit this file directly - use `dpkg-reconfigure gpsd' to
# change the options.
START_DAEMON="true" command to continue
GPSD_OPTIONS=""
DEVICES="/dev/ttyS1"
USBAUTO="false"
GPSD_SOCKET="/var/run/gpsd.sock"
but I am not getting NMEA data using gpsd...

Bluetooth Mesh provisioning using Meshctl: "connect" not working

I am able to provision, configure and control using BlueZ's meshctl tool on Raspberry Pi3. However, after restarting meshctl, or using "disconnect", I am not able to control my device. I tried the "connect" command after restarting meshctl, but it only starts discovery it seems. Is there any way to retain the control after restarting meshctl? Here is a snippet of my logs:
[meshctl]# connect 0 0100
Looking for node id 0100 on network with net index 0000
SetDiscoveryFilter success
Discovery started
Adapter property changed
[CHG] Controller B8:27:EB:46:C1:29 Discovering: yes
I am assuming the arguments for connect command are network key index which is 0 and Unicast address of the node to connect to which is 0100.
If it helps, going to onoff menu and trying to control gives the error "Failed to AcquireWrite". And BlueZ version is 5.50.
Thanks in advance!

Telit UL865 3G Modem ATD*99***1# Command “NO CARRIER” Response

Currently, I am working on Telit UL865-EUD 3G Modem. I worked with Telit GL865 GPRS modem before that's why I am familiar with AT commands and initialization logic.
My problem is that my UL865 modem always returns "NO CARRIER" to ATD*99***1# command. It is not only specific to ATD*99***1#. It results also same with other ATD Commands.
UL865 module is working. I attached to the network and open TCP socket. I tested them. But Dial Commands are not working.
My AT Command Log output is in below
Firmware Version : 12.00.616
AT
OK
AT&K=0
OK
AT#SCFG=3,1,300,600,300,10
OK
AT#SLED=2,2,2
OK
AT#SLEDSAV
OK
AT#FRWL=1,"1.2.3.4","0.0.0.0"
OK
AT+CGDCONT=1,"IP","mgbs"
OK
AT+CGSN
355855052854914
OK
AT#ICMP=2
OK
AT+CSQ
+CSQ: 24,2
OK
AT+CCLK?
+CCLK: "17/10/05,18:55:06+12"
OK
AT#SGACT=1,1,"mgbs",""
#SGACT: 5.***.***.***
OK
AT+COPS?
+COPS: 0,0,"TURKCELL",2
OK
AT+CREG?
+CREG: 0,1
OK
AT#USERID=""
OK
AT#PASSW=""
OK
AT#GAUTH=0
OK
AT#GPPPCFG="000.000.000.000"
OK
ATD*99***1#
NO CARRIER
Is there anybody who faces the same problem before?
Before the ATD command, try send:
AT+CUSD=1
This command in the Telit 3G Modules AT Commands Reference Guide:
allows control of the Unstructured Supplementary Service Data
Note that you are sending an USSD command (e.g. ATD*100#).

AT command to disconnect the dialup TAP connection

In our project, we dial a particular number, connect and then send the message successfully. After sending the message, we want to disconnect the call by sending the AT commands.
After sending the message successfully, we send #EOT#CR and then send +++ath0. It seems our dial up modem, does not disconnect call after we send +++ath0. When we see our usage on the carrier service provider website, it is showing the call duration of around up to 700 seconds. While on the debug terminal we can clearly see that the message sent successfully within less than 60 seconds.
Please give some guidance, why it does not disconnect the call.
Thanks.
AT Command for Hang-up(disconnect) dial-up modem is:
ATH
value:0 or 1
for example for disconnecting Send this String to Modem's port:
"ATH0;\r\n";
that semicolon determines you are able to send other AT commands.