> > fd = open("/proc/bus/usb/002/003", O_RDWR);
>
> It would make your program more flexible if the bus and device numbers
> were passed as command-line arguments instead of being fixed numbers.
> After all, those numbers will change every time you plug in the USB
> device.
Yes you have reas
Sorry but I was wrong compiling.
This is my programa
int main(){
struct usbdevfs_bulktransfer bulk;
struct usbdevfs_ioctl ctrl;
int fd;
int ret,*data,dato=0xFF,interface=0x00,*inter;
//data=&dato;
inter=&interface;
fd = open("/proc/bus/usb/0
I made this program
int main(){
struct usbdevfs_bulktransfer bulk;
struct usbdevfs_ioctl ctrl;
int fd;
int ret,*data,dato=0xFF,interface=0x00,*inter;
//data=&dato;
inter=&interface;
fd = open("/proc/bus/usb/002/003", O_RDWR);
if(fd != -1) {
Sorry but I did not understand you.
Once that I disconnect with this program:
nt main(){
struct usbdevfs_ioctl ctrl;
int fd;
fd = open("/proc/bus/usb/002/003", O_RDWR);
if(fd != -1) {
ctrl.ifno = 0;
ctrl.ioctl_code = USBDEVFS_DISCONNECT;
HI, did you remember me? I can't with this.
Now I get the next result after disconnect usbdevice, then connect,
and send data bulk.
kernel: usb 2-1: usbfs: USBDEVFS_BULK failed ep 0x1 len 4 ret -22
This is the code
fd = open("/proc/bus/usb/002/002", O_RDWR);
if(fd != -1) {
This is /proc/bus/usb/devices when I plug the PIC:
T: Bus=02 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 2 Spd=1.5 MxCh= 0
D: Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor= ProdID= Rev= 0.00
S: Manufacturer=Vicctor Lomaa
S: Product=PicNetUSB
C:* #Ifs= 1 Cfg#= 1 Atr=80 Mx
> ctrl.ifno = 0; /* Interface number */
> ctrl.ioctl_code = USBDEVFS_DISCONNECT;
> ioctl(fd, USBDEBVFS_IOCTL, &ctrl);
I've disconnected with that code and I've recived success. But when I
try to claim again, y receiv ioctl: Device or resource busy again.
-
#lsusb -v
Bus 002 Device 003: ID :
Device Descriptor:
bLength18
bDescriptorType 1
bcdUSB 1.00
bDeviceClass0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor
ioctl(fd, USBDEVFS_DISCONNECT);
perror("ioctl");
this is the result
ioctl: Inappropriate ioctl for device
I am watching tha the firmware is set for interrupt tranfer and this C
Code is for bulk transfer. This care? If this is the case, what I've
to do for change the C code fot interrupt tranfer
Maybe the firmware doesn't work for Linux. It could be?
---
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_idt12&al
# cat /proc/bus/usb/devices
T: Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2
B: Alloc= 0/900 us ( 0%), #Int= 0, #Iso= 0
D: Ver= 1.10 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor= ProdID= Rev= 2.06
S: Manufacturer=Linux 2.6.8-1-k7 uhci_hcd
S: Product=VIA
> I think you missed the obvious bug. You don't pass the value, you pass
> the pointer.
>
> So something like:
>
> >> ioctl(fd, USBDEVFS_CLAIMINTERFACE, &interface);
>
> should do the trick. I hope this helps,
>
With &interface I got:
ioctl: Device or resource busy
-
I changed the address for the variable containing 0 and I changed of
the number of bytes 1024 to 1 byte or 4 bytes like you said me. But
the result is the same
int main(){
struct usbdevfs_bulktransfer bulk;
int fd;
int ret,*data,dato=0xFF,interface=0x00,*inter;
data
Part C code:
ioctl(fd, USBDEVFS_CLAIMINTERFACE, 0);
perror("ioctl");
ret = ioctl(fd, USBDEVFS_BULK, &bulk);
perror("ioctl");
this is the result:
ioctl: Bad address
ioctl: Device or resource busy
#lsusb
Bus 002 Device 003: ID :
Syslog:
kernel: usb 2-2: usbfs: process 6073 (prueba3) did
The kernel is 2.6.
The syslog say that:
kernel: usb 2-2: usbfs: process 5274 (prueba2) did not claim interface
0 before use
I changed the source code including: ioctl(fd,
USBDEVFS_CLAIMINTERFACE, 0); where 0 is the bInterfaceNumber. But I
got the same thing:
ioctl: Bad address
ioctl: Device or re
Hi I need to send data to USB PIC16c745 this is my c code.
int main(){
struct usbdevfs_bulktransfer bulk;
int fd;
int ret,*data,dato=0xFF;
data=&dato;
fd = open("/proc/bus/usb/002/003", O_RDWR);
if(fd != -1) {
bulk.ep = 1;
bul
16 matches
Mail list logo