As using the normal serial device can’t filter out based on vid/pid I try now with MacUSBMBS from the MBS USB plugin.
The device I have is a so called BattLab-One which has an FTDI USB2UART chip on board.
For example a simple ‘j’ sent down to it returns back following hex data when using Python3 serial module:
In Xojo I use this for sending which works fine as I can see that it for example can switch voltage on the output:
dim s as string = TextField1.text
But when reading back with:
I always get:
Only in rare cases I get:
Where the data is exact as in Python starting from the 4th line…
Ah seems to work better now (o;
Shouldn’t have used the clear pipe command before sending/receiving…
Still wondering why it always prepends 0x0160 for every ReadRaw command though it doesn’t return anything:
Returned 2 bytes
Hex Read: 0160
The device doesn’t respond at all when sending “h” (power supply on).
Also not sure if to use MacUSBMBS at all…as there is no function/method to choose which interface to use when several devices have the same VID/PID/Name…so useless…
Seems FTDI devices are sending back their PID as the first two bytes in ReadRaw…regardless if anything was sent or not.
So 0x0160 is PID 0x6001 for the FTDI UART chips…
Prolific chips don’t send the PID prepended.
Just have to figure out how to initialize the Prolific ones to the correct UART settings…
but I guess libUSB seems to be the last resort then…
Well, you are basically running a raw connection and get the serial protocol.
So when you send our plugin doesn’t package it for you and when you receive, we don’t unpack it.
You may lookup the protocol details and you may find what is the meaning of the packages.
Some byte is probably the start of the package, some the end. Somewhere is the length of data and in the middle should be the data.
Already switching to libUSB as it supports more than one device with same VID/PID/Name (o;
Just have to figure out how I could package it with universal libusb-1.0.0.dylib…
You can usually just include the dylib in the frameworks folder of your app.
Well yes…that works for me on my Mac Mini M1 machine…
Question is how I can package it with an universal usblib…but then again…Intel is soon dead on Mac…and Apple will buy Advanced RISC machines after the dead NVidia deal
BTW: Are there any licensing issues with bundling libusb?
There are still something like 100 million Intel Macs out there with your customers.
libusb is LGPL, so you can include a dylib within the app and load it at runtime.
But question still remains (o;
How to build an universal libusb on M1 to package with an universal build…
You checked our libraries folder?
Oh, I See. That one is not yet ported to Apple Silicon.
Maybe you can just get one via homebrew pre-built and copy it.
So I need separate builds for Intel and M1?
Or is there a way to check during runtime on which silicon it runs?
No, you can lipo them together.