BlueZ-4.101 on embedded ARM device - python

I'm implementing Bluetooth on an embedded device and have a few questions about the BlueZ protocol stack. I'm using BlueZ-4.101 (do not have the option to upgrade to BlueZ-5), and do not have Python available.
Here are my questions after spending some time looking into BlueZ:
Is bluetoothd needed in my situation? As in, is it just a daemon that handles Python dbus messages between user-space and the kernel, or is it more? I've looked through the source and can only find mostly dbus related calls
How does one determine the value of DeviceID in /etc/bluetooth/main.conf? I found these instructions (section 3.4), but they are for a different platform using BlueZ 5
Will sdptool work without setting the DeviceID value? I've tried the following command and receive timeouts every time (only for my local device):
# sdptool browse local
Browsing FF:FF:FF:00:00:00 ...
Service Search failed: Connection timed out
Is it viable to replace all of the python simple-agent scripts with libbluetooth instead, or do I need to try and port them over to a supported scripting language?
Any help would be greatly appreciated!!!
If more logs are needed I can try and get them.

Related

FTDI 232H: USB Port 'Locked' to a physical port under Windows

Working with an Adafruit FTDI 232H Breakout assembly. I've already asked at Adafruit and FTDI and I'm still clueless. Writing in Python using the Adafruit-provided libraries and the FTDI libraries. Very new to Python and the FTDI 232H device...
Using Windows 10 Pro
I am able to successfully install the 'drivers' for the Adafruit based on this tutorial (specifically the Windows portion):
https://learn.adafruit.com/adafruit-ft232h-breakout?view=all
In the end, the interface will work, but what happens is that the device seems to be locked to a physical USB port. If I move the device to another USB port on the same machine, it is not recognized.
Based on some reading I've done, it seems like the driver, although installed in Windows, can only associate with the device on one port. Some say that Windows uses the serial number to keep track of what device uses what driver.
I have observed, using USBDView, that this device is not displaying a S/N. I have other devices that do not display a serial number and they can move from port to port without issue. This leads me to believe that the S/N tracking may not be 100% true in Windows. The Adafruit board does have a S/N in the EEPROM, but for some reason that information is not being provided to Windows / USBDView. I've not been able to successfully access the EEPROM via the FTProg utility.
I suspect that this might have something to to with the libusbK library that is installed via Zadig tool (again in the instructions) but I am not sure. FTDI says that there should not be any issue using the libusbK library.
Can anyone out there give me some pointers on:
Is it accurate that Windows uses the S/N to keep track of what driver goes with what device?
If so, how to get the FTDI device to display the S/N?
Is there some other setting in Windows that needs to be changed to allow this device to be used on other physical ports?
Is there any other utility like FTProg that could be used to work with the EEPROM?
Am I just missing something simple, Noob-style?
Thank you in advance,
I seem to recall a similar case related to COM port enumeration and Windows where the COM port enumeration is a hash of assorted variables including the PCI bus #, device #, etc. We witnessed this through the Microsoft devcon utility which is priceless and is a command line version of Device Manager.
https://learn.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon
https://blogs.technet.microsoft.com/deploymentguys/2009/12/16/where-to-find-devcon-exe/
If you google around, you can find the compiled version of this invaluable tool. With confidence, believe this tool will assist you to debug your USB port mystery. Good luck.

Openmpi with mpi4py don't work on multiple nodes

I have paralell python program written with mpi4py. I'm trying to make it distributed. I set up virtual machine, installed openmpi, openssh server, exchanged keys and all that. On local machine I have hostfile:
127.0.0.1 slots=4
192.168.1.104 slots=2
and i try to run program with:
mpirun -np 2 --hostfile hostfile python2 algen.py 0.85 0.02 20 70
but I get the following error:
[Kreutz:13090] tcp_peer_recv_connect_ack: invalid header type: 0
ORTE was unable to reliably start one or more daemons. This usually is
caused by:
not finding the required libraries and/or binaries on one or more nodes. Please check your PATH and LD_LIBRARY_PATH settings, or
configure OMPI with --enable-orterun-prefix-by-default
lack of authority to execute on one or more specified nodes. Please verify your allocation and authorities.
the inability to write startup files into /tmp (--tmpdir/orte_tmpdir_base). Please check with your sys admin to
determine the correct location to use.
compilation of the orted with dynamic libraries when static are required (e.g., on Cray). Please check your configure cmd line and
consider using one of the contrib/platform definitions for your
system type.
an inability to create a connection back to mpirun due to a lack of common network interfaces and/or no route found between them.
Please check network connectivity (including firewalls and network
routing requirements).
And i don't know what to do now. Do you have any ideas what could I try?

PyZMQ prompting windows to ask for network access on Windows even without anything other than IPC

I'm using PyZMQ for IPC (over TCP) on Windows 10, as part of an automated updater. I have noticed that on some computers, a firewall prompt appears to select if it can use public or private internet, despite the fact that it makes no connections to the internet - only to localhost.
This PyInstaller-packaged script is launched by a user-land script.
So:
Script launches my PyInstaller-packaged script->
Script uses pyzmq strictly to connect to localhost->
Windows prompts how it should be allowed through firewall
This prompt doesn't stop the program, but I don't want users to see that and wonder what virus they might have.
This is the code that supposedly triggers it:
sckt = self.zmq_context.socket(zmq.REQ)
sckt.connect('tcp://localhost:%s' % updater_shared_port)
Is there anything I can do to stop that pop-up from Windows Firewall?
Thanks!
Yes, there is something:
may implement the connection by some other than tcp:// transport class.
ZeroMQ can help you build your ideas via smart transports{ ipc:// | inproc:// | vmci:// } given you need not assemble/disassemble the full-height-L3-ISO-OSI stack to reach a counterparty, hosted on the same localhost.
The firewall could be configured to allow your programmes to run unhindered. That might be a nuissance to do by hand. There's probably a way to have an installer configure the firewall appropriately, but that'll be a ton of work to set up.
On the off-chance that it's the binding end that's the causing the pop up (not the connecting end as you suggest), apparently one can bind a zmq socket to a particular interface. This is done with a connection string such as zmq_bind(socket, "tcp://127.0.0.1:5555"); This will clamp the socket to the loopback, which may well not trouble the firewall at all. zmq_bind(socket, "tcp://*:5555) will open a socket on all interfaces, including any Internet facing interfaces, which should certainly grab the attention of the firewall. If you've not already tried that, might be worth a quick go.

BlueZ DBUS API - GATT interfaces unavailable for BLE device

I have a BLE device which has a bunch of GATT services running on it. My goal is to access and read data from the service characteristics on this device from a Linux computer (BlueZ version is 5.37). I have enabled experimental mode - therefore, full GATT support should be available. BlueZ's DBUS API, however, only provides the org.bluez.GattManager1 interface for the connected device, and not the org.bluez.GattCharacteristic1 or org.bluez.GattService1 interfaces which I need. Is there something I'm doing wrong? The device is connected and paired, and really I've just run out of ideas as how to make this work, or what may be wrong.
If it helps, I'm using Python and the DBUS module to interface with BlueZ.
A system update resolved this problem.

Macbook Pro 2015 connecting to a TI Sensortag cc2541

Background - What I would like to do is to be able to push buttons on a BT sensor and trigger some actions like tweet or play a particular sound etc. I have a TI CC2541 Sensortag that I would like to control with a python program.
Issue - I am unable to get Mac OS X bluetooth to recognize the BLE on TI Sensortag.
Attempts - I installed lightblue which recognizes the sensor. But I am not sure how that can help control the sensor programmatically.
I heard about Bluez in my research, but I guess it is related to linux only systems. I have used Evothings and that can connect to the sensortag through my phone on the same network. I can make small changes to the javascript on evothings studio to capture events from the Sensortag and affect changes on the evothings app.
I am trying to get my Mac to recognize the BLE Sensortag after which I can control the device programmatically. Do I need to buy one of these pluggable BLE dongles to get this to work? OR am I attempting something wrong.
Please advise.
Oh I see now, I can help you with that.
Here's your recipe to success:
Make sure that your hardware supports BLE 4.x (yours does)
Link your tag through the preferences/Bluetooth widget
Check with lightblue app that you can connect or read some values
If all the above checks out, and it should given the information you provided, then at hardware level you're golden.
At software level, there are many ways to connect and retrieve data. You can use XCODE and build a native OSX app or you can build a NodeJS app to retrieve data from the tag.
On this blog post you find all you need for the Node scenario. It is documented for the Raspberry Pi however, the code for running this elsewhere, including OSX, is exactly the same
The code is hosted here and I keep it up to date as I make more advancements.
https://github.com/kywix/iamsblog/tree/master/SensorTag
Shortly:
Open terminal and git clone that repo
cd into the folder SensorTag
type npm install (to install all the libraries necessary)
node logger.js to run the basic example
turn on your device
btw on the same repo you will find python code as well. I blog regularly about the Sensor Tag.
I will make note of creating a post just for folks like you that seek this type of info, I have been there..

Categories

Resources