Hi,

i'm actually trying to bulk write to a USB ticket printer.

The printer is reachable through /proc/bus/usb/001/002

You can see here some details on /var/log/messages:
sb 1-2: new full speed USB device using hc-crisv10 and address 2
usb 1-2: ep0 maxpacket = 8
usb 1-2: default language 0x0409
usb 1-2: new device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-2: Product: QL-550
usb 1-2: Manufacturer: Brother
usb 1-2: SerialNumber: A7G113560
usb 1-2: adding 1-2:1.0 (config #1, interface 0)
drivers/usb/core/inode.c: creating file '002'
hub 1-0:1.0: state 5 ports 2 chg 0000 evt 0004
hub 1-0:1.0: port 2 enable change, status 00000003

Here is the c code i'm compiling:

#include <usb.h>
#include <linux/ioctl.h>
#include <linux/usbdevice_fs.h>

#define O_RDWR          0x0002

int main(){
         struct usbdevfs_bulktransfer bulk;
         struct usbdevfs_ioctl ctrl;
         int fd,ret,interface=0x00;
         static unsigned char dato[4] = {0xFF, 0, 0, 0};
         fd = open("/proc/bus/usb/001/002", O_RDWR);
         if(fd != -1) {
                 //bulk.ep = USB_DIR_IN | 1;
                 bulk.ep = 1;
                 bulk.len = 4;
                 bulk.data = &dato;
                 bulk.timeout = 1000;
                 ioctl(fd, USBDEVFS_CLAIMINTERFACE, &interface);
                 perror("ioctl");
                 ioctl(fd, USBDEVFS_BULK, &bulk);
                 perror("ioctl");
                 close(fd);
         }else
                 printf("Error opening");
         return 0;
}

After compiling with the sdk here is the output when running on the fox
board:
ioctl: Success
ioctl: No such file or directory

Anyone has an idea of what is going wrong with my code ?

Anyone succeed to talk to a usb port using C or shell ?

Thanks in advance for any help.



Reply via email to