pymtprotocol
pymtprotocol copied to clipboard
Exiting with `Segmentation fault: 11`
Hey there,
thanks for your work to reverse engineer the protocol and sharing it!
When I execute glm-server.py
I just get Segmentation fault: 11
, then it exits. I don't have a clue where to start.
I found this, but as it got fixed within 3.3.3 this shouldn't be the issue https://stackoverflow.com/questions/19531969/segmentation-fault-11-in-os-x
The GLM 100 C is connected via Bluetooth, it shows up as BOSCH GLM 100 C x0524
(same on a Windows laptop). Is this how it should be or could the device be broken? Seems a bit strange to me having a hex value within the Bluetooth name.
Thanks for your help!
MacBook Pro 13" Late 2016
MacOS Sierra 13.3.3
Python 3.6.0 :: Anaconda 4.3.1 (x86_64)
Hi Philip,
Thanks for the report. The device's Bluetooth name looks fine. I haven't tested with Python 3.6; my setup uses Python 3.4.8 from MacPorts. Unfortunately, the way I used ctypes + pyobjc in this project is fragile and I've had problems getting it to work on new machines before. Try this in place of the line in CentralController.initWithQueue_knownDevices_ that sets self.centralManager?
try:
x = x.initWithDelegate_queue_(self, queue)
except TypeError:
queue = osx.dispatch_queue_from_id(queue)
x = x.initWithDelegate_queue_(self, queue)
self.centralManager = x
Actually, could you please try running this code by itself?
libSystem = ctypes.CDLL('libSystem.dylib')
libSystem.dispatch_get_global_queue.restype = ctypes.c_void_p
libSystem.dispatch_get_global_queue.argtypes = (ctypes.c_long, ctypes.c_ulong)
queue_pointer = libSystem.dispatch_get_global_queue(0x15, 0)
queue_object = CoreBluetooth.objc.objc_object(c_void_p=queue_pointer)
print('1')
x1 = CoreBluetooth.CBCentralManager.alloc().initWithDelegate_queue_(None, queue_object)
print('2')
x2 = CoreBluetooth.CBCentralManager.alloc().initWithDelegate_queue_(None, queue_pointer)
print('3')
If I understand the problem you're having, then this should print 1 and 2, but not 3. Thanks!
As I was looking for a multi-platform way to use the GLM100C for measuring and as far as I understood you're using BLE, which seems to be impossible to get it to a multi-platform software, I searched for a different approach.
I connected to its serial port interface with pybluez
under Windows. Using this information I got it to measure and turn laser as well as backlight on and off. So far this is a adequate solution for my purposes.
As it is quite hard for me to get through your code, I did not see how far the commands are identical. Maybe you want to take a look?
Never the less I'll test your instructions.
You we're right!
1
2
Segmentation fault: 11