[BlueZ] 1、Download install and use the BlueZ and hcitool on

2019-12-03 12:43栏目:计算机操作
TAG:

LINKS

  • 1.Bluetooth on Modern Linux by Szymon Janc
  • 2.dbus-python tutorial
  • 3.Linux bluetooth setup with bluez and hcitool
  • 4.hcitool lescan shows I/O error

图片 1

@beautifulzzzz
智能硬件、物联网,热爱技术,关注产品
博客:http://blog.beautifulzzzz.com
园友交流群:414948975

Install numpy, tdpm, pillow, scrip etc...

Go to File -> Settings

In Project: -> Project interpreter, make sure you have a python2.7 selected.  Click the green plus sign at the right.  Then search whatever the package you need to install and click Install Package button at the bottom of the new page you just opened to mount it.

Caution: To run tensorflow using GPU, better to do not install it from pycharm.  See the UPDATE below how to install it.


1. Introduction

Bluez is the default Bluetooth protocol stack on Linux. It should be present and installed on your Linux distribution. If not, building and installing from source is not too difficult:

  • Download the latest stable source release of Bluez from here. Unzip the compressed file you downloaded.
  • Install the headers and libraries required for Bluez compilation:

图片 2


2. Download And Install

I follow the blog (Installing Bluez 5.44 onto Raspbian?) to install bluez-5.50.

Download the most recent version from the official page:.

For example, at the time of writing it was 5.50, so I used(on my pi):

wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.50.tar.xz

Then I extracted it and built it:

tar -xf bluez-5.50.tar.xz
cd bluez-5.50

Read the README! It lists the dependencies and the configure switches:

Install the dependencies first: (glib, dbus, libdbus, udev, etc.)

sudo apt install libdbus-1-dev libudev-dev libical-dev libreadline-dev

note: If you do not install the libdbus-1-dev, you will later get this strange error:

configure: error: D-Bus >= 1.6 is required

once you've installed dependencies, you can configure switches:

./configure --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc --localstatedir=/var  --enable-experimental

then do:

make
sudo make install

It takes maybe 10 minutes to compile. After installing, you should find bluetoothd in /usr/libexec/bluetooth. You should also see bluetoothd in /usr/lib/bluetooth.

Go to each of these directories and type

./bluetoothd --version

You'll note that the one in libexec is new and the one in lib is old.

In order to make sure that d-bus is talking to you new BlueZ 5.50 and not your old BlueZ 5.43, you need to tell systemd to use the new bluetooth daemon:

sudo vim /lib/systemd/system/bluetooth.service

Make sure the exec.start line points to your new daemon in /usr/libexec/bluetooth.

For me, that wasn't enough. No matter what, upon restart I always got bluetoothd 5.43... So I just created a symlink from the old one to the new.

First rename the old file:

sudo mv /usr/lib/bluetooth/bluetoothd /usr/lib/bluetooth/bluetoothd-543.orig

Create the symlink:

sudo ln -s /usr/libexec/bluetooth/bluetoothd /usr/lib/bluetooth/bluetoothd
sudo systemctl daemon-reload

That should do it.

图片 3

The version compatibility across the OS and these packages is a nightmare for every new person who tries to use Tensorflow.  In here, I record the successful procedure to install everything listed in the title of this note.

图片 4

Install pip

Open Pycharm that you just installed.  Create a project.  Use Alt + F12or View -> Tool Windowto open the terminal.

Then follow the instructions in here: https://www.rosehosting.com/blog/how-to-install-pip-on-ubuntu-16-04/

1. Connect to SSH and Update your System Software

First of all, connect to your server via SSH and make sure that all your system software is up to date. Run the following command to update the package list and upgrade all your system software to the latest version available:

sudo apt-get update && sudo apt-get -y upgrade

2. Install Pip on Ubuntu 16.04

Once the upgrade is completed, you can move on and install Pip on your Ubuntu VPS. The installation of Pip is very simple. The only thing you need to do is to run the following command:

sudo apt-get install python-pip

3. Verify the Pip Installation on Ubuntu 16.04

The apt package manager will install Pip and all the dependencies required for the software to work optimally. Once the installation is completed you can verify that it was successful by using the following command:

pip -V

You should see something similar to the following:

# pip -V

pip 8.1.1 from /usr/lib/python2.7/dist-packages (python 2.7)

That means Pip has been successfully installed on your Ubuntu server and it is ready to use.


3.1 setup bluetooth service

Start the bluetooth service and enable automatic startup, assuming you're using systemd as the init daemon:

sudo systemctl start bluetooth.service
sudo systemctl enable bluetooth.service

UPDATE:

3.3 bluetooth service discovery

Now we have the bluetooth MAC address of the target device, use the sdptool command to know which services (like DUN, Handsfree audio) are available on that target device.

sdptool browse 28:ED:6A:A0:26:B7

You can also use the interactive bluetoothctl tool for this purpose.

If the target device is present, you can ping it with l2ping command, requires root privilege:

➜  bluez-5.50  sudo l2ping 94:87:E0:B3:AC:6F
Ping: 94:87:E0:B3:AC:6F from B8:27:EB:8E:CC:51 (data size 44) ...
44 bytes from 94:87:E0:B3:AC:6F id 0 time 53.94ms
44 bytes from 94:87:E0:B3:AC:6F id 1 time 77.12ms
44 bytes from 94:87:E0:B3:AC:6F id 2 time 38.63ms
44 bytes from 94:87:E0:B3:AC:6F id 3 time 46.13ms
44 bytes from 94:87:E0:B3:AC:6F id 4 time 59.96ms
5 sent, 5 received, 0% loss

So, bluetooth service discovery is useful to determine the type of the device, like if it's a bluetooth mp3 player or it's a keyboard.

图片 5

lsb_release -a 

星期日, 02. 九月 2018 11:58下午 - beautifulzzzz

Installing CUDA Toolkit 8.0 on Ubuntu 16.04

ref: http://www.pradeepadiga.me/blog/2017/03/22/installing-cuda-toolkit-8-0-on-ubuntu-16-04/

GCC

One of them is to ensure where GCC is installed or not. We can confirm it by executing the following command.

gcc --version

Since I am using Ubuntu, GCC comes pre-installed and here is the output that I got.

图片 6

build essentials

It is important have thebuild-essential package installed. This is usually pre-installed on Ubuntu, however if it is not you can install it by executing the following command.

sudo apt-get install build-essential

On my laptop it was already installed hence I got the following output.

图片 7

Download CUDA package from NVIDIA website

Navigate to https://developer.nvidia.com/cuda-downloads and download the appropriate package.

图片 8

Once the page is successfully downloaded, we need to install the package. First navigate to the folder where the package is located. In my case it is under ~/Downloads/CUDA$ folder. Then issue the following command which installs the package.

sudo dpkg -i cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64.deb

图片 9

Then update the package list from the repositories using the below command.

sudo apt-get update

Then install CUDA by executing the following command.

sudo apt-get install cuda

图片 10

After a couple of minutes the installation would succeed and you should a screen similar to the following.

图片 11

One of the important post installation steps is to update the PATH variable to include the CUDA binaries folder. To update it, we need to edit the file /etc/environment. I use the nano text editor in this post, so the command would be

sudo nano /etc/environment

Once nano is open edit the PATH variable to include /usr/local/cuda-8.0/bin folder. After editing the file screen would look like this.

图片 12

After editing this line press Ctrl + X to exit the editor and press Y when prompted whether you want to save it.

This method of editing the PATH variable usually requires a reboot to take effect. However executing the below command would update the PATH variable immediately.

source /etc/environment

Now we are ready to validate the CUDA installation. Just execute the following command in the terminal.

nvcc --version

If the installation was successful, we should see the CUDA compiler version as seen in this screenshot.

图片 13

Alternatively you can also execute the following command in the terminal. This gives more detailed information about the drivers.

nvidia-smi

图片 14

We are now ready to enjoy the goodness of CUDA and can continue with the installation of TensorFlow. Stay tuned for the installation instructions of TensorFlow.


版权声明:本文由澳门新濠登录网址发布于计算机操作,转载请注明出处:[BlueZ] 1、Download install and use the BlueZ and hcitool on