Wie sprichst Du den Baustein an?
Wenn Du über /dev/usb/ oder /proc/bus/usb gehst, sollte ein einfaches
chmod oder chown reichen.
ehrlich gesagt, weis ich das nciht so genau! ich glaube das anders gelöst! Ich
habe ein programm von www.iowarrior.de weiterverwendet, da ich die
ansteuerung selbst nicht geschafft habe!
mfg
jan
PS: hier noch mein Programm: ich hoffed as hilft weiter mir weiter zu
helfen! :) Danke!
#include
#include
#define iowVendor 0x07c0
#define iowProduct 0x1500
class iow
{
private:
struct usb_bus* bus;
struct usb_device *device;
usb_dev_handle *devhandle;
int argc;
char* argv[];
public:
char IOPINS[4];
usb_dev_handle *IOW_Open();
int writeiow();
iow();
~iow();
};
iow::iow ()
{
usb_init();
usb_find_busses();
usb_find_devices();
for( bus = usb_busses; bus; bus = bus->next )
for( device = bus->devices;device;device=device->next)
if ( (device->descriptor.idVendor == iowVendor ) &&
(device->descriptor.idProduct == iowProduct ) &&
(devhandle = usb_open(device)) ) {
printf ("IOWarrior:\t\tgefunden\n");
}
if (devhandle==NULL)
{
printf("IOWarrior konnte nicht geoeffnet werden\n");
exit(-1);
}
else
{
if(!usb_set_configuration(devhandle,1)==0)
printf("Set the config\n");
if(!usb_claim_interface(devhandle,0)==0)
printf("Claimed interface\n");
}
}
iow::~iow ()
{
usb_release_interface (devhandle,0);
}
int iow::writeiow()
{
// usb_control_msg(devhandle, 0x21, 0x09, 0x0200,0,IOPINS, 4,100);
printf("Writing:\t\t%d bytes\n");
// invertieren der Werte
IOPINS[0]=IOPINS[0]-(2*IOPINS[0]);
IOPINS[1]=IOPINS[1]-(2*IOPINS[1]);
IOPINS[2]=IOPINS[2]-(2*IOPINS[2]);
IOPINS[3]=IOPINS[3]-(2*IOPINS[3])-0x01;
usb_control_msg(devhandle, 0x21, 0x09, 0x0200,0,IOPINS, 4,10);
return 0;
}