{"id":16508,"date":"2017-01-27T10:14:48","date_gmt":"2017-01-27T16:14:48","guid":{"rendered":"http:\/\/www.multitech.net\/developer\/?page_id=16508"},"modified":"2019-09-04T09:29:09","modified_gmt":"2019-09-04T14:29:09","slug":"bluetooth","status":"publish","type":"page","link":"https:\/\/www.multitech.net\/developer\/software\/mlinux\/using-mlinux\/bluetooth\/","title":{"rendered":"Bluetooth"},"content":{"rendered":"<p><em>This feature is only available on certain products and models (not available with all devices).<\/em><\/p>\n<p><strong>NOTE:<\/strong> This information only applies to mLinux<sup>\u2122\u00a0<\/sup>3.x firmware which uses BlueZ4. For Bluetooth on mLinux 4.x or higher, refer to <a href=\"https:\/\/www.multitech.net\/developer\/software\/mlinux\/using-mlinux\/bluez-5-pan-setup\/\">BlueZ5 Pan Setup<\/a>\u00a0and <a href=\"https:\/\/www.multitech.net\/developer\/software\/mlinux\/using-mlinux\/bluez-5-serial-setup\/\">BlueZ5 Serial Setup<\/a>.<\/p>\n<p><b>Bluetooth Setup<\/b><\/p>\n<p>The device includes BlueZ 4 software used as a Bluetooth stack. \u00a0To operate, you must install BlueZ 4 on your Linux computer.<\/p>\n<p>For newer levels of Linux, you may need to find BlueZ 4 outside of the normal software package manager.<\/p>\n<p>You can also use BlueZ 5 with Ubuntu on your Linux machine. You need to set up BlueZ 5 with compatibility mode for BlueZ 4 on your PC.<\/p>\n<p><b>BlueZ 5 using Ubuntu on Linux Computer \u2013 Set Compatibility Mode<\/b><\/p>\n<p>To set BlueZ 5 in compatibility mode:<\/p>\n<p style=\"padding-left: 30px;\">1. Find the file <b>\/etc\/systemd\/system\/dbus-org.bluez.service<\/b>.<br \/>\n2. Change the line by replacing:<\/p>\n<pre class=\"brush:shell\">ExecStart=\/usr\/lib\/bluetooth\/bluetoothd<\/pre>\n<p style=\"padding-left: 30px;\">with<\/p>\n<pre class=\"brush:shell\">ExecStart=\/usr\/lib\/bluetooth\/bluetoothd --compat<\/pre>\n<p style=\"padding-left: 30px;\">3.\u00a0To restart bluetooth, enter:<span style=\"font-family: 'andale mono', times;\">\u00a0<\/span><\/p>\n<pre class=\"brush:shell\">pc: sudo systemctl daemon-reload\r\npc: sudo systemctl restart bluetooth<\/pre>\n<p style=\"padding-left: 30px;\">4. To change permissions on <b>\/var\/run\/sdp<\/b> , enter:<span style=\"font-family: 'andale mono', times;\">\u00a0<\/span><\/p>\n<pre class=\"brush:shell\">pc: sudo chmod 777 \/var\/run\/sdp<\/pre>\n<p style=\"padding-left: 30px;\">5. If you are using GUI management on your Linux system, verify that Bluetooth is on and set it to visible.\u00a0Or if you are using the command line, enter:<span style=\"font-family: 'andale mono', times;\">\u00a0<\/span><\/p>\n<pre class=\"brush:shell\">pc: sudo hciconfig hci0 piscan<\/pre>\n<p><b>Classic Bluetooth Serial Communications<\/b><\/p>\n<p>If you log in through the debug port to the device using Minicom, you need to change the Minicom control character.\u00a0You can&#8217;t have two levels of Minicom and control both with the same character.<\/p>\n<p>You can also use SSH instead.<\/p>\n<p>To change the character in Minicom:<\/p>\n<p style=\"padding-left: 30px;\">1. Enter the command:<\/p>\n<pre class=\"brush:shell\">pc: sudo minicom -s<\/pre>\n<p style=\"padding-left: 30px;\">\u00a0This command displays the <b>Configuration menu<\/b> for Minicom.<\/p>\n<p style=\"padding-left: 30px;\">2. \u00a0\u00a0Under the <b>Configuration<\/b>, select <b>Screen and keyboard<\/b>.<\/p>\n<p style=\"padding-left: 30px;\">3. \u00a0\u00a0Enter the command key: <b>B <\/b>(the resulting command key is <b>&lt;ctrl&gt; + B)<\/b>.<\/p>\n<p style=\"padding-left: 30px;\">4. \u00a0\u00a0Select <b>&lt;esc&gt;<\/b> which returns you to <b>Configuration<\/b>.<\/p>\n<p style=\"padding-left: 30px;\">5. \u00a0\u00a0Select <b>Save setup as dfl <\/b>which sets your recent configuration as default.<\/p>\n<p style=\"padding-left: 30px;\">6. \u00a0\u00a0Select <b>Exit from Minicom<\/b>.<\/p>\n<p><b>Bring up Bluetooth<\/b><\/p>\n<p>To bring up Bluetooth using Ubuntu, enter this command:<br \/>\n<span style=\"font-family: 'andale mono', times;\"><br \/>\n<\/span><\/p>\n<pre class=\"brush:shell\">pc: sudo hciconfig hci0 up<\/pre>\n<p><b>Bluetooth reset<\/b><\/p>\n<p>Bluetooth resets automatically on reboot.<\/p>\n<p>To manually reset Bluetooth, enter the following commands:<\/p>\n<pre class=\"brush:shell\">pc: sudo systemctl daemon-reload\r\npc: systemctl restart bluetooth<\/pre>\n<p><b>Bluetooth TTY communications with Ubuntu<\/b><\/p>\n<p>To use Ubuntu for Bluetooth communications:<\/p>\n<p style=\"padding-left: 30px;\">1. Enter the command:<\/p>\n<pre class=\"brush:shell\">pc: sudo hciconfig hci0 up<\/pre>\n<p style=\"padding-left: 30px;\">2. On Ubuntu Linux, determine the bluetooth MAC address. \u00a0Enter the command:<span style=\"font-family: 'andale mono', times;\">\u00a0<\/span><\/p>\n<pre class=\"brush:shell\">pc: hciconfig<\/pre>\n<p style=\"padding-left: 30px;\">The system displays the following:<span style=\"font-family: 'andale mono', times;\">\u00a0<\/span><\/p>\n<pre class=\"brush:shell\">hci0:\u00a0 Type: BR\/EDR\u00a0 Bus: USB\r\nBD Address: 00:02:72:21:A7:D7\u00a0 ACL MTU: 1021:7\u00a0 SCO MTU: 64:1\r\nUP RUNNING PSCAN ISCAN\r\nRX bytes:59680 acl:3203 sco:0 events:1827 errors:0\r\nTX bytes:47076 acl:3264 sco:0 commands:115 errors:0<\/pre>\n<p style=\"padding-left: 30px;\">For this example above, the address is: <b>00:02:72:21:A7:D7<\/b><\/p>\n<p style=\"padding-left: 30px;\"><b><\/b>3. Create a TTY node for Bluetooth communications (for both sides). Enter the following:<span style=\"font-family: 'andale mono', times;\">\u00a0<\/span><\/p>\n<pre class=\"brush:shell\">pc: sudo mknod -m 666 \/dev\/rfcomm0 c 216 0<\/pre>\n<p style=\"padding-left: 30px;\">4. Make Bluetooth discoverable on a scan. Enter:<span style=\"font-family: 'andale mono', times;\">\u00a0<\/span><\/p>\n<pre class=\"brush:shell\">pc: sudo \/usr\/sbin\/hciconfig hci0 piscan<\/pre>\n<p style=\"padding-left: 30px;\">5. Add the channel. Enter:<span style=\"font-family: 'andale mono', times;\">\u00a0<\/span><\/p>\n<pre class=\"brush:shell\">pc: sudo \/usr\/bin\/sdptool add --channel=22 SP<\/pre>\n<p style=\"padding-left: 30px;\">6. Start RFCOMM to listen for a connection. Enter:<span style=\"font-family: 'andale mono', times;\">\u00a0<\/span><\/p>\n<pre class=\"brush:shell\">pc: sudo rfcomm listen \/dev\/rfcomm0 22 &amp;<\/pre>\n<p style=\"padding-left: 30px;\">7. Now log into the device. Use the MAC address from Ubuntu on the rfcomm command line as in this example. Enter the following:<span style=\"font-family: 'andale mono', times;\">\u00a0<\/span><\/p>\n<pre class=\"brush:shell\">mtcdt: \/usr\/sbin\/bluetoothd\r\nmtcdt: hciconfig hci0 up\r\nmtcdt: hcitool scan\r\nmtcdt: mknod -m 666 \/dev\/rfcomm0 c 216 0\r\nmtcdt: rfcomm connect \/dev\/rfcomm0 00:02:72:21:A7:D7 22 &amp;<\/pre>\n<p style=\"padding-left: 30px;\">Example output (Bluetooth messages are written to the console):<span style=\"font-family: 'andale mono', times;\">\u00a0<\/span><\/p>\n<pre class=\"brush:shell\">[1] 571\r\nBluetooth: RFCOMM TTY layer initialized\r\nBluetooth: RFCOMM socket layer initialized\r\nBluetooth: RFCOMM ver 1.11\r\nConnected \/dev\/rfcomm0 to 00:02:72:21:A7:D7 on channel 22\r\nPress CTRL-C for hangup<\/pre>\n<p style=\"padding-left: 30px;\">8. Now you list the connections from each side entering the same <strong>hcitool con<\/strong> command twice (one for master and one for slave):<span style=\"font-family: 'andale mono', times;\">\u00a0<\/span><\/p>\n<pre class=\"brush:shell\">mtcdt: hcitool con\r\nConnections:\r\n&lt; ACL 00:02:72:21:A7:D7 handle 1 state 1 lm MASTER<\/pre>\n<pre class=\"brush:shell\">mtcdt: hcitool con\r\nConnections:\r\n&gt; ACL 00:23:A7:49:5C:D9 handle 11 state 1 lm SLAVE<\/pre>\n<p style=\"padding-left: 30px;\">The other system should now see the connection.<\/p>\n<p style=\"padding-left: 30px;\">9. Start minicom on the computer and the device:<span style=\"font-family: 'andale mono', times;\">\u00a0<\/span><\/p>\n<pre class=\"brush:shell\">pc: sudo minicom -D \/dev\/rfcomm0\r\nmtcdt: &lt;ctrl&gt;bE\u00a0 [This turns echo on]\r\nmtcdt: &lt;ctrl&gt;bA\u00a0 [This adds a line feed]\r\nmtcdt: minicom -D \/dev\/rfcomm0\r\nmtcdt: &lt;ctrl&gt;aE\u00a0 [This turns echo on]\r\nmtcdt: &lt;ctrl&gt;aA\u00a0 [This adds a line feed]<\/pre>\n<p style=\"padding-left: 30px;\">Now you have a TTY connection to communicate.<\/p>\n<p style=\"padding-left: 30px;\">10. Type a message and watch it appear on the other side.<\/p>\n<p style=\"padding-left: 30px;\">11. To terminate in minicom, enter:<span style=\"font-family: 'andale mono', times;\"><br \/>\n<\/span><\/p>\n<pre class=\"brush:shell\">mtcdt: &lt;ctrl&gt;aX or &lt;ctrl&gt;bX.<\/pre>\n<p style=\"padding-left: 30px;\">12. If you connect to the rfcomm0 device because the interface is in a bad state, reset as shown:<span style=\"font-family: 'andale mono', times;\">\u00a0<\/span><\/p>\n<pre class=\"brush:shell\">mtcdt: rfcomm release 0\r\nmtcdt: hciconfig hci0 up\r\nmtcdt: \/usr\/sbin\/hciconfig hci0 piscan<\/pre>\n<p style=\"padding-left: 30px;\">This clears rfcomm0<\/p>\n<p style=\"padding-left: 30px;\">13. Now enter the appropriate <i>rfcomm<\/i> command on both sides and the link should come back up.<\/p>\n<p><b>Classic Bluetooth File Push (sending data)<\/b><\/p>\n<p>To do <b>File Push<\/b> on Bluetooth, you first must verify your computer runs Ubuntu with Bluetooth. Use the Ubuntu system with Bluetooth to receive the data.<\/p>\n<p>Follow these instructions to do <b>File Push<\/b>:<\/p>\n<p style=\"padding-left: 30px;\">1. On the device, install the following two packages:<\/p>\n<pre class=\"brush:shell\">mtcdt: libopenobex1_1.5-r0.0_arm926ejste.ipk\r\nmtcdt: obexftp_0.23-r0.0_arm926ejste.ipk<\/pre>\n<p style=\"padding-left: 30px;\">2. In Ubuntu, under <b>Personal File Sharing Preferences<\/b> and <b>Receive Files over Bluetooth<\/b>, check <b>Receive Files in Downloads folder over Bluetooth<\/b>.<\/p>\n<p style=\"padding-left: 30px;\">3. In the drop-down, <b>Accept files,<\/b><i> <\/i>select<i> <\/i><b>Always<\/b><b> <\/b>and check <b>Notify about received files<\/b>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" src=\"https:\/\/www.multitech.net\/developer\/wp-content\/uploads\/2017\/01\/Ubuntu_screen_cap_personal_file_sharing.png\" width=\"414\" height=\"811\" \/><\/p>\n<p style=\"padding-left: 30px;\">Received files will be in the <b>Downloads<\/b> directory.<\/p>\n<p style=\"padding-left: 30px;\">4. Obtain the <b>MAC address<\/b> of the ubuntu system using this command:<span style=\"font-family: 'andale mono', times;\"><br \/>\n<\/span><\/p>\n<pre class=\"brush:shell\">mtcdt: hciconfig<\/pre>\n<p style=\"padding-left: 30px;\">The system displays the following results:<span style=\"font-family: 'andale mono', times;\">\u00a0<\/span><\/p>\n<pre class=\"brush:shell\">hci0:\u00a0 Type: BR\/EDR\u00a0 Bus: USB\r\nBD Address: 5C:F3:70:74:04:AF\u00a0 ACL MTU: 1021:8\u00a0 SCO MTU: 64:1\r\nUP RUNNING PSCAN ISCAN\r\nRX bytes:98993 acl:854 sco:0 events:904 errors:0\r\nTX bytes:21459 acl:632 sco:0 commands:289 errors:0<\/pre>\n<p style=\"padding-left: 30px;\">In this case, the <b>MAC address<\/b> is <b>5C:F3:70:74:04:AF<\/b> labeled as\u00a0<b>BD address<\/b>.<\/p>\n<p style=\"padding-left: 30px;\">5. Copy a large file to the device for testing.<span style=\"font-family: 'andale mono', times;\"><br \/>\n<\/span><\/p>\n<pre class=\"brush:shell\">mtcdt: cd \/boot\r\nmtcdt: scp initrd.img-3.13.0-98-generic root@conduit:\/var\/volatile<\/pre>\n<p style=\"padding-left: 30px;\">6. On the PC, find the channel number to specify in the list the services of the Ubuntu system. Enter:<span style=\"font-family: 'andale mono', times;\">\u00a0<\/span><\/p>\n<pre class=\"brush:shell\">PC: sdptool browse local<\/pre>\n<p style=\"padding-left: 30px;\"><span style=\"font-family: 'andale mono', times;\">\u00a0<\/span>The following results display:<span style=\"font-family: 'andale mono', times;\">\u00a0<\/span><\/p>\n<pre class=\"brush:shell\">...\r\nService Name: OBEX Object Push\r\nService RecHandle: 0x10008\r\nService Class ID List:\r\n\u00a0 \u00a0 \u00a0 \u00a0\"OBEX Object Push\" (0x1105)\r\nProtocol Descriptor List:\r\n\u00a0 \u00a0 \u00a0 \"L2CAP\" (0x0100)\r\n\u00a0 \u00a0 \u00a0 \"RFCOMM\" (0x0003)\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0Channel: 9\r\n\u00a0 \u00a0 \u00a0 \"OBEX\" (0x0008)\r\nProfile Descriptor List:\r\n\u00a0 \u00a0\"OBEX Object Push\" (0x1105)\r\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 Version: 0x0100\r\n...<\/pre>\n<p style=\"padding-left: 30px;\">Under <b>OBEX Object Push<\/b>, look for <b>Channel<\/b> in the listing. In this case, the channel number is <b>9<\/b>.<\/p>\n<p style=\"padding-left: 30px;\">7.To execute the File Push, enter the directory location and the following command including the MAC address and channel number:<span style=\"font-family: 'andale mono', times;\">\u00a0<\/span><\/p>\n<pre class=\"brush:shell\">mtcdt: cd \/var\/volatile\r\nmtcdt: time obexftp -SH -b 5C:F3:70:74:04:AF -B 9 -U none -p linux_3.13.0.orig.tar.gz -o f1<\/pre>\n<p><b>Bring down Bluetooth<\/b><\/p>\n<p>To bring down Bluetooth using Ubuntu, enter this command:<span style=\"font-family: 'andale mono', times;\"><br \/>\n<\/span><\/p>\n<pre class=\"brush:shell\">pc: sudo hciconfig hci0 down<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This feature is only available on certain products and models (not available with all devices). NOTE: This information only applies to mLinux\u2122\u00a03.x firmware which uses BlueZ4. For Bluetooth on mLinux 4.x or higher, refer to BlueZ5 Pan Setup\u00a0and BlueZ5 Serial Setup. Bluetooth Setup The device includes BlueZ 4 software used as a Bluetooth stack. \u00a0To [&hellip;]<\/p>\n","protected":false},"author":1478,"featured_media":0,"parent":9184,"menu_order":9,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"class_list":["post-16508","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages\/16508","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/users\/1478"}],"replies":[{"embeddable":true,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/comments?post=16508"}],"version-history":[{"count":64,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages\/16508\/revisions"}],"predecessor-version":[{"id":16559,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages\/16508\/revisions\/16559"}],"up":[{"embeddable":true,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages\/9184"}],"wp:attachment":[{"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/media?parent=16508"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}