Scilab Home Page | Wiki | Bug Tracker | Forge | Mailing List Archives | Scilab Online Help | File Exchange
ATOMS : USB Toolbox details
Login with GitLab

USB Toolbox

Provide a set to function to communicate directly from Scilab with USB Devices
(8691 downloads for this version - 13981 downloads for all versions)
Details
Version
1.1.1
A more recent valid version exists: 1.2.0
Author
Jose Pablo Castro Valverde
Owner Organization
EDDAD
Maintainer
Jose PAblo Castro-Valverde
License
Creation Date
October 3, 2012
Source created on
Scilab 5.4.x
Binaries available on
Scilab 5.4.x:
Linux 32-bit Linux 64-bit
Scilab 5.5.x:
Linux 64-bit Linux 32-bit
Install command
--> atomsInstall("usb_toolbox")
Description
            The goal of this module is to provide a set to function to communicate directly
from Scilab with USB Device on Linux, Windows and Mac OS X. 

 Hid communication process based on HIDAPI (this library works on those SO with
a native driver). http://www.signal11.us/oss/hidapi/

 Bulk communication process for custom USB class based on libusb-1.0 on Linux.
Windows uses the same libusb-1.0 base on WinUsb http://www.libusb.org/wiki/windows_backend
. The Windows backend should be considered EXPERIMENTAL. Mac OS X untested yet.

 CDC communication process based on Serial Communication Toolbox or custom based
on termios (linux) and  API win32 (windows). I am not sure yet

 Collection of macros to uses as interface. Those macros verify the OS and the
USB class process and made the adjustments needed to successful communication 
process
 
HID Tested on:

 + GNU/Linux Ubuntu 32 Bits Full Tested 
    -Make a list with every hid device connected. Show VendorID and ProductID.
Passed
    -Read Manufacture, Product and Serial String. Passed
    -Write to the hid testing device. Passed
    -Read to the hid testing device. Passed
    -Set Feature Report to the hid testing device. Passed
    -Get Feature Report to the hid testing device. Passed
    +Needs libusb-1.0 develop package to compile on Linux

 + GNU/Linux Ubuntu 64 Bits Partial Tested 
    -Make a list with every hid device connected. Show VendorID and ProductID.
Passed
    -Read Manufacture, Product and Serial String. Passed
    -Write to the hid testing device. Untested
    -Read to the hid testing device. Untested
    -Set Feature Report to the hid testing device. Untested
    -Get Feature Report to the hid testing device. Untested
    +Needs libusb-1.0 develop package to compile on Linux

 + Windows XP OS 32 Bits Partial Tested 
    -I have problems to initialized my hid testing device on Windows.
    -Make a list with every hid device connected. Show VendorID and ProductID.
Passed
    -Read Manufacture, Product and Serial String. Passed
    -Write to the hid testing device. Failed
    -Read to the hid testing device. Failed
    -Set Feature Report to the hid testing device. Failed
    -Get Feature Report to the hid testing device. Failed
    +Needs MinGW module to compile on Windows
Note: I tested the HIDAPI on Windows with the example included with the HIDAPI
library but it do not work. I guess its something with the Feature Reports
process and/or Windows driver.

BULK Tested on:

 + GNU/Linux Ubuntu 32 Bits Full Tested
    -Make a list with every usb device connected. Show VendorID and ProductID.
Passed
    -Read Manufacture, Product and Serial String. Passed
    -Write to the bulk testing device. Passed
    -Read  to the bulk testing device. Passed
    +Needs libusb-1.0 develop package to compile on Linux

 + GNU/Linux Ubuntu 32 Bits Partial Tested
    -Make a list with every usb device connected. Show VendorID and ProductID.
Passed
    -Read Manufacture, Product and Serial String. Passed
    -Write to the bulk testing device. Untested
    -Read  to the bulk testing device. Untested
    +Needs libusb-1.0 develop package to compile on Linux

 + Windows XP OS 32 Bits Partial Tested 
    -Same problems that the hid testing device with the bulk testing device on
Windows.
    -Make a list with every hid device connected. Show VendorID and ProductID.
Passed
    -Read Manufacture, Product and Serial String. Passed
    -Write to the bulk testing device. Failed
    -Read  to the bulk testing device. Failed
    +Needs MinGW module to compile on Windows

ToDo
HID
 + re-test in Windows OS 32 Bits (both libusb-1.0 and libusbx-1.0)
 + test in Windows OS 64 Bits (both libusb-1.0 and libusbx-1.0)
 + test in MacOS X 32 Bits
 + test in MacOS X 64 Bits
 + implement a rutine similar to lsusb that shows (only HID Devices):
    - VendorID 
    - ProductID
    - Endpoints In
    - Endpoints Out
    - Interfaces
    - Max packet size to transfer in any direction
    - Manufacter Index and String (If there are any)
    - Product Index and String (If there are any)
    - Serial Index and String (If there are any)
    - Etcetera
BULK
 + re-test in Windows OS 32 Bits (both libusb-1.0 and libusbx-1.0)
 + test in Windows OS 64 Bits (both libusb-1.0 and libusbx-1.0)
 + test in MacOS X 32 Bits
 + test in MacOS X 64 Bits
 + implement a rutine similar to lsusb that shows(any USB Devices):
    - VendorID 
    - ProductID
    - Endpoints In
    - Endpoints Out
    - Interfaces
    - Max packet size to transfer in any direction
    - Manufacter Index and String (If there are any)
    - Product Index and String (If there are any)
    - Serial Index and String (If there are any)
    - Etcetera

NOTE: 
I will wait for a while to see how different libusb-1.0 (http://libusb.org/) 
and libusbx-1.0 (http://libusbx.org/) really
are and which one its most stable on each OS to take a finally decision of which
USB library continue using to develop and improved usb_toolbox. Meanwhile am
gonna made some testing of both implementation on windows to see how they works
and explore the backend source code. I will appreciate any suggestions.             
Files (5)
[8.05 MB]
Source code archive
makes it available for Scilab 5.4
[8.01 MB]
Linux 32-bit binary for Scilab 5.4.x
Linux 32-bit
Automatically generated by the ATOMS compilation chain

[8.02 MB]
Linux 64-bit binary for Scilab 5.4.x
Linux 64-bit
Automatically generated by the ATOMS compilation chain

[8.17 MB]
Linux 64-bit binary for Scilab 5.5.x
Linux version (x86_64)
Automatically generated by the ATOMS compilation chain

[8.17 MB]
Linux 32-bit binary for Scilab 5.5.x
Linux version (i686)
Automatically generated by the ATOMS compilation chain

News (0)
Comments (4)     Leave a comment 
Comment from Jeff Waters -- September 17, 2014, 08:59:33 PM    
After loading USB toolbox, closing Scilab and reopening I get the following warning,...
how to fix ???

Start USB Comunication Toolbox
Start usb_toolboxlib
WARNING: Libusb-1.0 drivers not detected.


Thanks All

Jeff

Comment from Kaushik MK -- April 9, 2014, 06:17:12 PM    
I am getting the error " The package usb_toolbox is not available" please guide
me on how to 
install this toolbox
Comment from Silvio Kuehn -- April 1, 2013, 03:24:24 PM    
Thank you for providing this toolbox (1.1.1).

I have some comments about compiling and using this toolbox. I used the mingw-compiler 
and its environment on win7/64 and i got some problems during compiling process: 

First:
The #define option: "#define Top (*getNbArgumentOnStack(pvApiCtx))" in
c:\Program
Files
\scilab-5.4.0\modules\api_scilab\includes\api_common.h kills the "Top" in file
c:\Users
\myName\gcc\x86_64-w64-mingw32\include\wincon.h. I undefined the "Top" in this
mention 
file and got success. In my case it is an ugly workaround, but it works.

Second:
The function hid_read_timeout() always blocks, if no data comes from the usb-device. I 
commented the while-loop (not its content) in function "int
sci_hid_read_timeout(char 
*fname)" in c:\Program Files\scilab-5.4.0\contrib\usb-toolbox-src\sci_gateway\c
\sci_hidapi.c. 

Third:
If one wants to send data from the Host to a device, don't forget the additional 0x00-
Byte in front of your data. On windows, not linux.

All took me hours. I hope somebody appreciates these hints.

After all, it works fine. Thank you again!

Have a nice day
Leave a comment
You must register and log in before leaving a comment.
Login with GitLab
Email notifications
Send me email when this toolbox has changes, new files or a new release.
You must register and log in before setting up notifications.