{"id":2080,"date":"2015-06-18T16:25:32","date_gmt":"2015-06-18T16:25:32","guid":{"rendered":"https:\/\/raspberry-projects.com\/pi\/?p=2080"},"modified":"2015-06-26T09:00:16","modified_gmt":"2015-06-26T09:00:16","slug":"bluetooth-commands","status":"publish","type":"post","link":"https:\/\/raspberry-projects.com\/pi\/pi-operating-systems\/raspbian\/bluetooth\/bluetooth-commands","title":{"rendered":"Bluetooth Commands"},"content":{"rendered":"<p>\n<strong><em>In these notes &quot;xx:xx:xx:xx:xx:xx&quot; means the MAC address of the remote&nbsp;bluetooth device<\/em><\/strong>\n<\/p>\n<h4>\nReset Bluetooth Adaptor<br \/>\n<\/h4>\n<pre>\r\n<code>\r\nsudo hciconfig hci0 reset\r\n<\/code><\/pre>\n<h4>\nRestart Bluetooth Service<br \/>\n<\/h4>\n<pre>\r\n<code>\r\nsudo invoke-rc.d bluetooth restart\r\n<\/code><\/pre>\n<h4>\nList Bluetooth Adaptors<br \/>\n<\/h4>\n<pre>\r\n<code>\r\nhciconfig\r\n<\/code><\/pre>\n<h4>\nScan for Bluetooth devices<br \/>\n<\/h4>\n<pre>\r\n<code>\r\nhcitool scan\r\n<\/code><\/pre>\n<p>\nTo then connect to one of the found devices &nbsp;you can use this:\n<\/p>\n<pre>\r\n<code>\r\nsudo bluez-simple-agent hci0 xx:xx:xx:xx:xx:xx\r\n<\/code><\/pre>\n<h4>\nMake The Raspberry Pi Discoverable<br \/>\n<\/h4>\n<pre>\r\n<code>\r\nsudo hciconfig hci0 piscan\r\n<\/code><\/pre>\n<p>\nYou will now be able to search and find the RPi from other devices such as windows &quot;Add A Device&quot; (development tip &#8211;&nbsp;if you&#39;ve previously connected you&#39;ll need to remove it from Windows Devices for it to be able to found it again by Add A Device)\n<\/p>\n<p>\nTo allow the connection to complete you need to also do the following step&nbsp;to allow a remote device to actually connect:\n<\/p>\n<pre>\r\n<code>\r\nsudo bluetooth-agent 1234\r\n<\/code><\/pre>\n<p>\n1234 is the pairing code for it to use, but this will can be automatically&nbsp;overridden by a randomly selected code&nbsp;displayed on both devices\n<\/p>\n<h4>\nDiscover Bluetooth Devices<br \/>\n<\/h4>\n<pre>\r\n<code>\r\nhcitool scan\r\n<\/code><\/pre>\n<h4>\nList Previously Paired Devices<br \/>\n<\/h4>\n<pre>\r\n<code>\r\nbluez-test-device list\r\n<\/code><\/pre>\n<p>\n(This will appear to do nothing if there are no devices).\n<\/p>\n<h4>\nRemove&nbsp;Previously&nbsp;Paired Device<br \/>\n<\/h4>\n<p>\nYou will need to get the devices MAC address by using the List command\n<\/p>\n<p>\nIf you need to disconnect it first:\n<\/p>\n<pre>\r\n<code>\r\nbluez-test-device disconnect xx:xx:xx:xx:xx:xx\r\n<\/code><\/pre>\n<p>\nThen\n<\/p>\n<pre>\r\n<code>\r\nbluez-test-device remove xx:xx:xx:xx:xx:xx\r\n<\/code><\/pre>\n<h4>\nPing Device<br \/>\n<\/h4>\n<pre>\r\n<code>\r\nsudo l2ping -c 1 xx:xx:xx:xx:xx:xx\r\n<\/code><\/pre>\n<p>\n&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In these notes &quot;xx:xx:xx:xx:xx:xx&quot; means the MAC address of the remote&nbsp;bluetooth device Reset Bluetooth Adaptor sudo hciconfig hci0 reset Restart Bluetooth Service sudo invoke-rc.d bluetooth restart List Bluetooth Adaptors hciconfig Scan for Bluetooth devices hcitool scan To then connect to one of the found devices &nbsp;you can use this: sudo bluez-simple-agent hci0 xx:xx:xx:xx:xx:xx Make The [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[100],"tags":[],"class_list":["post-2080","post","type-post","status-publish","format-standard","hentry","category-bluetooth"],"_links":{"self":[{"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/posts\/2080","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/comments?post=2080"}],"version-history":[{"count":14,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/posts\/2080\/revisions"}],"predecessor-version":[{"id":2143,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/posts\/2080\/revisions\/2143"}],"wp:attachment":[{"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/media?parent=2080"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/categories?post=2080"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/tags?post=2080"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}