From: Nuno S. <ns...@ed...> - 2009-07-07 16:09:21
|
Hi again, I'm claiming interface before setting mode: This is my device side control packets handling (LUFA syntax): case 0x12: if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_VENDOR | REQREC_DEVICE)) { Endpoint_ClearSetupReceived(); PORTD ^=0xff; /* Send the flag to the host */ Endpoint_ClearSetupOUT(); } break; And my libusb transfer request: uint8_t data = 0x00; int r; r = libusb_control_transfer(handle, 0x40, 0x12, 0, 0, &data, 1, 1000); 0x12 is my request... i choose 0x12 as I could choose 0x00 as I'm trying to set up vendor request, right? then I'm looking for a request type from host to device, from vendor type, which target is the device itself REQDIR_HOSTTODEVICE -> 0 at bit 7 REQTYPE_VENDOR -> 2 at bit 5 means 10 starting at bit 5 REQREC_DEVICE -> 00000 starting at bit 0 Results in 0100 0000 which is 0x40! I have a -9 error an endpoint error Still haven't found the problem... Thx, Nuno Tim Roberts wrote: > Nuno Santos wrote: > >> Today I was doing some experiments on control transfers with libusb. I >> was setting a custom request to process on the device side, >> and then invoking a control transfer on the host side to activate that >> request. >> >> I was getting pipe error on the transaction. >> >> My device is only composed by a unique custom endpoint but I was >> assuming the use of the default control endpoint. >> >> Why could this not be working? What can possibly be the most direct >> cause? >> >> > > What exactly was the request you were trying? One of the bit fields in > the request code (in bmRequestType) says whether the request is aimed at > the device, the interface, the endpoint, or "other". If you pick > "interface" or "endpoint", then you must have claimed the interface > number that is specified in the request. This trips up some people, > because the Windows kernel does not enforce this. The Linux kernel does. > > However, I think that reports an EACCESS error, so I could be blowing > smoke. How large was the transfer? Control transfers are quite limited > in size. > > |