Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am trying to manually connect between my laptop and phone. I have bluez-utils version 4.98-2ubuntu7 installed. When I run the agent on the terminal, I get:

asheesh@U32U:~$ sudo bluetooth-agent 4835
Pincode request for device /org/bluez/980/hci0/dev<id>
Authorizing request for /org/bluez/980/hci0/dev<id>

The pincode request line gets printed when I try to pair from my phone. After I enter the passkey on being prompted, the device gets authorized. I can now send files to the laptop from my phone. However, the application gets stuck after authorizing request and control is not passed back to the terminal.

Why is this happening? How do I get back control?

This seems to be contrary to examples I have seen across the internet, where the terminal becomes available after authorization to run further commands.

I realise that running it in the background is a possible solution, but since I need to run certain other tasks once pairing is completed, I would prefer to have it run in the foreground.

I tried using this:

bluetooth-agent "$PIN" 1> ./bluelog #Background run tested also

However, the process does not write its output to file till it completes (or is killed), so I cannot test the output in bluelog. Is there a way to force the process to write output before completion?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

This is just a workaround to the problem. Any suggestions on how to tackle the actual problem of bluetooth-agent stalling are welcome.


I used stdbuf to disable line buffering of STDOUT when running bluetooth-agent in the background. This updates the log file in real time, thereby letting me check and trigger the rest of the activities that need to be done.

stdbuf -o 0 bluetooth-agent "$PIN" 1> ./bluelog &
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.