All, does anybody have some code or plugin to access USB ports with Pharo? Maybe something using libUSB or OpenUSB? Thanks, Udo
I guess not :-) I'll try to wrap libUSB then. I assume the future-proof way to use "a" FFI framework is to use the NB notation? Do I remember correctly that the NB notation is supposed to remain the same although the backend will change to something more like traditional FFI? So using NB notation w/o relying on the code generation is safe, correct? CU, Udo On 23.03.2015 16:15, Udo Schneider wrote:
All,
does anybody have some code or plugin to access USB ports with Pharo? Maybe something using libUSB or OpenUSB?
Thanks,
Udo
If the library is big you can use TalkFFI (you will find it in smalltalkhub) that automates the wrapping with nativeboost. On Tue, Mar 24, 2015 at 4:58 PM, Udo Schneider <Udo.Schneider@homeaddress.de
wrote:
I guess not :-)
I'll try to wrap libUSB then.
I assume the future-proof way to use "a" FFI framework is to use the NB notation? Do I remember correctly that the NB notation is supposed to remain the same although the backend will change to something more like traditional FFI? So using NB notation w/o relying on the code generation is safe, correct?
CU,
Udo
On 23.03.2015 16:15, Udo Schneider wrote:
All,
does anybody have some code or plugin to access USB ports with Pharo? Maybe something using libUSB or OpenUSB?
Thanks,
Udo
Just had a quick start with TalkFFI ... and after getting 32bit libs on Mac OS X it finally worked. However running TalkFFI results in a wallback because (I assume) a type can't be infered. Is there any way to debug TalkFFI to get the C name of the offending type/function? All I'm seeing are their addresses :-( CU, Udo On 24/03/15 17:33, kilon alios wrote:
If the library is big you can use TalkFFI (you will find it in smalltalkhub) that automates the wrapping with nativeboost.
On Tue, Mar 24, 2015 at 4:58 PM, Udo Schneider <Udo.Schneider@homeaddress.de <mailto:Udo.Schneider@homeaddress.de>> wrote:
I guess not :-)
I'll try to wrap libUSB then.
I assume the future-proof way to use "a" FFI framework is to use the NB notation? Do I remember correctly that the NB notation is supposed to remain the same although the backend will change to something more like traditional FFI? So using NB notation w/o relying on the code generation is safe, correct?
CU,
Udo
On 23.03.2015 16:15, Udo Schneider wrote:
All,
does anybody have some code or plugin to access USB ports with Pharo? Maybe something using libUSB or OpenUSB?
Thanks,
Udo
I found the offending code. The original code is something like: struct libusb_bos_dev_capability_descriptor *dev_capability #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) [] /* valid C99 code */ #else [0] /* non-standard, but usually working code */ #endif ; This doesn't work with clang/TalkFFI. I assume based on the #defines it uses the C99 notation which doesn't work. "Hardcoding" it to the non-standard notation does work. E.g.: struct libusb_bos_dev_capability_descriptor *dev_capability //#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) // [] /* valid C99 code */ //#else [0] /* non-standard, but usually working code */ //#endif ; It seems that this was the only showstopper as TalkFFI just generated a binding for the whole library w/o any problem. I'll start experimenting now ... CU, Udo On 24/03/15 17:33, kilon alios wrote:
If the library is big you can use TalkFFI (you will find it in smalltalkhub) that automates the wrapping with nativeboost.
On Tue, Mar 24, 2015 at 4:58 PM, Udo Schneider <Udo.Schneider@homeaddress.de <mailto:Udo.Schneider@homeaddress.de>> wrote:
I guess not :-)
I'll try to wrap libUSB then.
I assume the future-proof way to use "a" FFI framework is to use the NB notation? Do I remember correctly that the NB notation is supposed to remain the same although the backend will change to something more like traditional FFI? So using NB notation w/o relying on the code generation is safe, correct?
CU,
Udo
On 23.03.2015 16:15, Udo Schneider wrote:
All,
does anybody have some code or plugin to access USB ports with Pharo? Maybe something using libUSB or OpenUSB?
Thanks,
Udo
Hi Udo, Thanks to report your experience on TalkFFI. Can you also post a small step by step tutorial of what you did to generate the NB bindings ? Thanks, #Luc 2015-03-25 11:37 GMT+01:00 Udo Schneider <udo.schneider@homeaddress.de>:
I found the offending code. The original code is something like:
struct libusb_bos_dev_capability_descriptor *dev_capability #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) [] /* valid C99 code */ #else [0] /* non-standard, but usually working code */ #endif ;
This doesn't work with clang/TalkFFI. I assume based on the #defines it uses the C99 notation which doesn't work. "Hardcoding" it to the non-standard notation does work. E.g.:
struct libusb_bos_dev_capability_descriptor *dev_capability //#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) // [] /* valid C99 code */ //#else [0] /* non-standard, but usually working code */ //#endif ;
It seems that this was the only showstopper as TalkFFI just generated a binding for the whole library w/o any problem.
I'll start experimenting now ...
CU,
Udo
On 24/03/15 17:33, kilon alios wrote:
If the library is big you can use TalkFFI (you will find it in smalltalkhub) that automates the wrapping with nativeboost.
On Tue, Mar 24, 2015 at 4:58 PM, Udo Schneider <Udo.Schneider@homeaddress.de <mailto:Udo.Schneider@homeaddress.de>> wrote:
I guess not :-)
I'll try to wrap libUSB then.
I assume the future-proof way to use "a" FFI framework is to use the NB notation? Do I remember correctly that the NB notation is supposed to remain the same although the backend will change to something more like traditional FFI? So using NB notation w/o relying on the code generation is safe, correct?
CU,
Udo
On 23.03.2015 16:15, Udo Schneider wrote:
All,
does anybody have some code or plugin to access USB ports with Pharo? Maybe something using libUSB or OpenUSB?
Thanks,
Udo
Hi Luc, Yepp will do. Time to write a blog entry again :-) CU, Udo On 25/03/15 11:42, Luc Fabresse wrote:
Hi Udo,
Thanks to report your experience on TalkFFI. Can you also post a small step by step tutorial of what you did to generate the NB bindings ?
Thanks,
#Luc
2015-03-25 11:37 GMT+01:00 Udo Schneider <udo.schneider@homeaddress.de <mailto:udo.schneider@homeaddress.de>>:
I found the offending code. The original code is something like:
struct libusb_bos_dev_capability___descriptor *dev_capability #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) [] /* valid C99 code */ #else [0] /* non-standard, but usually working code */ #endif ;
This doesn't work with clang/TalkFFI. I assume based on the #defines it uses the C99 notation which doesn't work. "Hardcoding" it to the non-standard notation does work. E.g.:
struct libusb_bos_dev_capability___descriptor *dev_capability //#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) // [] /* valid C99 code */ //#else [0] /* non-standard, but usually working code */ //#endif ;
It seems that this was the only showstopper as TalkFFI just generated a binding for the whole library w/o any problem.
I'll start experimenting now ...
CU,
Udo
On 24/03/15 17:33, kilon alios wrote:
If the library is big you can use TalkFFI (you will find it in smalltalkhub) that automates the wrapping with nativeboost.
On Tue, Mar 24, 2015 at 4:58 PM, Udo Schneider <Udo.Schneider@homeaddress.de <mailto:Udo.Schneider@homeaddress.de> <mailto:Udo.Schneider@__homeaddress.de <mailto:Udo.Schneider@homeaddress.de>>> wrote:
I guess not :-)
I'll try to wrap libUSB then.
I assume the future-proof way to use "a" FFI framework is to use the NB notation? Do I remember correctly that the NB notation is supposed to remain the same although the backend will change to something more like traditional FFI? So using NB notation w/o relying on the code generation is safe, correct?
CU,
Udo
On 23.03.2015 16:15, Udo Schneider wrote:
All,
does anybody have some code or plugin to access USB ports with Pharo? Maybe something using libUSB or OpenUSB?
Thanks,
Udo
Nice, thanks a lot! Luc 2015-03-25 11:47 GMT+01:00 Udo Schneider <udo.schneider@homeaddress.de>:
Hi Luc,
Yepp will do. Time to write a blog entry again :-)
CU,
Udo
On 25/03/15 11:42, Luc Fabresse wrote:
Hi Udo,
Thanks to report your experience on TalkFFI. Can you also post a small step by step tutorial of what you did to generate the NB bindings ?
Thanks,
#Luc
2015-03-25 11:37 GMT+01:00 Udo Schneider <udo.schneider@homeaddress.de <mailto:udo.schneider@homeaddress.de>>:
I found the offending code. The original code is something like:
struct libusb_bos_dev_capability___descriptor *dev_capability #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) [] /* valid C99 code */ #else [0] /* non-standard, but usually working code */ #endif ;
This doesn't work with clang/TalkFFI. I assume based on the #defines it uses the C99 notation which doesn't work. "Hardcoding" it to the non-standard notation does work. E.g.:
struct libusb_bos_dev_capability___descriptor *dev_capability //#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) // [] /* valid C99 code */ //#else [0] /* non-standard, but usually working code */ //#endif ;
It seems that this was the only showstopper as TalkFFI just generated a binding for the whole library w/o any problem.
I'll start experimenting now ...
CU,
Udo
On 24/03/15 17:33, kilon alios wrote:
If the library is big you can use TalkFFI (you will find it in smalltalkhub) that automates the wrapping with nativeboost.
On Tue, Mar 24, 2015 at 4:58 PM, Udo Schneider <Udo.Schneider@homeaddress.de <mailto:Udo.Schneider@homeaddress.de> <mailto:Udo.Schneider@__homeaddress.de <mailto:Udo.Schneider@homeaddress.de>>> wrote:
I guess not :-)
I'll try to wrap libUSB then.
I assume the future-proof way to use "a" FFI framework is to use the NB notation? Do I remember correctly that the NB notation is supposed to remain the same although the backend will change to something more like traditional FFI? So using NB notation w/o relying on the code generation is safe, correct?
CU,
Udo
On 23.03.2015 16:15, Udo Schneider wrote:
All,
does anybody have some code or plugin to access USB ports with Pharo? Maybe something using libUSB or OpenUSB?
Thanks,
Udo
I have not used TalkFFI I only know that it exists. Very glad it works for you and I am also very interested on a blog post how you got it working and how you solved your problems. I am sure it will come handy one day :) On Wed, Mar 25, 2015 at 12:37 PM, Udo Schneider < udo.schneider@homeaddress.de> wrote:
I found the offending code. The original code is something like:
struct libusb_bos_dev_capability_descriptor *dev_capability #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) [] /* valid C99 code */ #else [0] /* non-standard, but usually working code */ #endif ;
This doesn't work with clang/TalkFFI. I assume based on the #defines it uses the C99 notation which doesn't work. "Hardcoding" it to the non-standard notation does work. E.g.:
struct libusb_bos_dev_capability_descriptor *dev_capability //#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) // [] /* valid C99 code */ //#else [0] /* non-standard, but usually working code */ //#endif ;
It seems that this was the only showstopper as TalkFFI just generated a binding for the whole library w/o any problem.
I'll start experimenting now ...
CU,
Udo
On 24/03/15 17:33, kilon alios wrote:
If the library is big you can use TalkFFI (you will find it in smalltalkhub) that automates the wrapping with nativeboost.
On Tue, Mar 24, 2015 at 4:58 PM, Udo Schneider <Udo.Schneider@homeaddress.de <mailto:Udo.Schneider@homeaddress.de>> wrote:
I guess not :-)
I'll try to wrap libUSB then.
I assume the future-proof way to use "a" FFI framework is to use the NB notation? Do I remember correctly that the NB notation is supposed to remain the same although the backend will change to something more like traditional FFI? So using NB notation w/o relying on the code generation is safe, correct?
CU,
Udo
On 23.03.2015 16:15, Udo Schneider wrote:
All,
does anybody have some code or plugin to access USB ports with Pharo? Maybe something using libUSB or OpenUSB?
Thanks,
Udo
Le 24/3/15 15:58, Udo Schneider a écrit :
I guess not :-)
I'll try to wrap libUSB then.
I assume the future-proof way to use "a" FFI framework is to use the NB notation? Do I remember correctly that the NB notation is supposed to remain the same although the backend will change to something more like traditional FFI?
Yes
So using NB notation w/o relying on the code generation is safe, correct?
Yes!
CU,
Udo
On 23.03.2015 16:15, Udo Schneider wrote:
All,
does anybody have some code or plugin to access USB ports with Pharo? Maybe something using libUSB or OpenUSB?
Thanks,
Udo
participants (5)
-
kilon alios -
Luc Fabresse -
stepharo -
Udo Schneider -
Udo Schneider