[plt-scheme] libusb FFI binding

From: Jakub Piotr Cłapa (jpc at pld-linux.org)
Date: Sun Mar 4 22:08:31 EST 2007

Ray wrote:
> Have made some minimal headway in binding to libusb.

How far have you gotten? It's that I have a quite finished one which I 
haven't published because I wanted to polish it a little. Considering 
that there seems to be some interest maybe we could use my work? I'm 
attaching a file which I'm currently using in my project. Works on Win32 
and OS X (untested on Linux yet) with a custom USB device based on 
AVRUSB (the software USB implementation).

I would be thankful if anybody could look into it (it's my first 
nontrivial Scheme app) and comment on anything (style, good habits, errors).

Known issues:
1. Some less important structs are not yet added.
2. Almost no struct accessors are provided (but some quite cool 
functions for finding devices on the bus are so it's usable).

Btw. apropos FFI:
1. PATH_MAX (and maybe some other C constants) could be exported in 
%foreign. It would make the bindings more bullet proof.

2. _enum could be more flexible. Currently there is no way to get a 
number corresponding to a symbol... Maybe allow for expressions 
evaluated with unhygienically added _enum symbols binded to 
corresponding numbers. I wanted to pass numbers instead of symbols (for 
custom request codes) and had to make a new ctype. Expressions evaled on 
function call with enum symbols bound would solve this problem (and some 
other too).

Jakub Piotr Cłapa
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: usb.scm
URL: <http://lists.racket-lang.org/users/archive/attachments/20070305/61c49cb7/attachment.ksh>

Posted on the users mailing list.