Goal
I have a HITSLAM Camera Shutter Bluetooth button (which is a AB Shutter 3 device, a common Bluetooth camera remote control) which I want to connect to my NVIDIA Jetson Nano using Bluetooth, so that I can use the button's input for some task.
What I Have Done
I am using the PyBluez library for connecting. I use the following to find out which port and protocol the AB Shutter 3 uses (where target_device_address
is the AB Shutter 3's device address):
service_matches = bt.find_service(name=None,uuid=None,address=target_device_address)
first_match = service_matches[0]
print("Port {}, Name {}, Host {}, Protocol {}".format(first_match['port'], first_match['name'], first_match['host'], first_match['protocol']))
This is how I get the port (17) which to connect to and the protocol (L2CAP) it uses.
Now, I try to connect to it using the following:
client_sock = bt.BluetoothSocket(bt.L2CAP)
client_sock.connect((target_device_address,port))
I have also used Python's native socket
library (which have yielded me the same results):
client_sock = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_SEQPACKET, socket.BTPROTO_L2CAP)
client_sock.connect((target_device_address,port))
Which it successfully connects according to hcitool
, after which I wait for user input:
if target_device_address in (subprocess.getoutput("hcitool con")).split():
print('connected')
while True:
data = client_sock.recv(1024)
print(str(data))
Issues
- The device actually does not show up as an input in
/dev/input/
. When I connect it manually through the GUI, it shows up as/dev/input/event5
. - After connecting, there is no input captured by my script.
My Questions
- How does it connect according to
hcitool con
yet not be registered as an input device (and register any inputs)? - What do you suggest doing? I have looked everywhere and do not seem to get a proper solution. There is a workaround with implementing a bash script that uses
bluetoothctl
to connect to the Bluetooth remote control, but it just does not make sense to me why Python cannot make this connection and retrieve information.