# How do I send text to a Torobot USB device?

I'm trying to get the "Torobot" USB servo controller to work with Angstrom Linux on a Beagle Board XM.

The servo controller registers as a USB device. The device just takes simple text commands, but there is no TTY associated with it. So I'm not sure how to send commands to it.

Can I just send data like this (assuming that 002/005 is the device):

\$ cat file.txt >> /dev/bus/usb/002/005


Or do I need to associate it with the generic USB device? If so, how do I do that?

you can pyusb for send data http://pyusb.sourceforge.net/docs/1.0/tutorial.html and your data information is here http://www.torobot.com/down/usc_en.pdf i think you python code like this

    import usb.core
import usb.util

# find our device
dev = usb.core.find(idVendor=0xfffe, idProduct=0x0001)

# was it found?
if dev is None:

# set the active configuration. With no arguments, the first
# configuration will be the active one
dev.set_configuration()

# get an endpoint instance
cfg = dev.get_active_configuration()
interface_number = cfg[(0,0)].bInterfaceNumber
alternate_settting = usb.control.get_interface(interface_number)
intf = usb.util.find_descriptor(
cfg, bInterfaceNumber = interface_number,
bAlternateSetting = alternate_setting
)

ep = usb.util.find_descriptor(
intf,
# match the first OUT endpoint
custom_match = \
lambda e: \
usb.util.ENDPOINT_OUT
)

assert ep is not None

# write the data
ep.write('#1P1500T100\r\n')

• cool - I'll have to dust off my (weak) python chops...but will give it a try. Thanks! Aug 29 '13 at 19:04
• thanks... there a lot of dependencies that don't come on the Angstrom distribution for this. I have filled most of those, but still getting errors. See my latest question: robotics.stackexchange.com/questions/2132/… Dec 7 '13 at 23:41
• I could not get pyUSB to work - but I did find away to access the board directly through the tty Dec 15 '13 at 9:24

Finally Success:

I found that the Torobot USB board could be communicated with an Arduino serial driver. Conveniently this is available through opkg:

opkg install kernel-module-cdc-acm


When the board is plugged in, it comes up as

/dev/ttyACM0


From here you can simply echo commands to the device.

echo "#8P1500T100" > /dev/ttyACM0


This basically says "set servo 8 to position 1500 with speed 100"