I would like to write a class driver for a force feed back driving wheel.
Data can be read from the wheel by modifying the class driver for mouse.
Since there is another endpoint for interrupt out, I establish another pipe
for interrupt out and add a function .write for sending data to the device.
In the write function, i call the usdb_io in the following way
…
memcpy(wheel->ep_out_buf, init1, 15);
usbd_setup_interrupt( wheel->urb, URB_DIR_OUT, wheel->ep_out_buf, 15 );
if( status = usbd_io( wheel->urb, wheel->ep_out, NULL, wheel,
USBD_TIME_INFINITY ) ) {
return( status );
}
After returning from the above and the write function, there is no effect to
the device. In addition, I get blocked by calling the read function
afterward. What am I doing wrong? Thank you for advice.
: I would like to write a class driver for a force feed back driving wheel.
: Data can be read from the wheel by modifying the class driver for mouse.
: Since there is another endpoint for interrupt out, I establish another pipe
: for interrupt out and add a function .write for sending data to the device.
: In the write function, i call the usdb_io in the following way
: …
: memcpy(wheel->ep_out_buf, init1, 15);
: usbd_setup_interrupt( wheel->urb, URB_DIR_OUT, wheel->ep_out_buf, 15 );
: if( status = usbd_io( wheel->urb, wheel->ep_out, NULL, wheel,
: USBD_TIME_INFINITY ) ) {
: return( status );
: }
Are you using a separate URB for the In and Out Endpoint ?
: After returning from the above and the write function, there is no effect to
: the device. In addition, I get blocked by calling the read function
: afterward. What am I doing wrong? Thank you for advice.
: I would like to write a class driver for a force feed back driving
wheel.
: Data can be read from the wheel by modifying the class driver for mouse.
: Since there is another endpoint for interrupt out, I establish another
pipe
: for interrupt out and add a function .write for sending data to the
device.
: In the write function, i call the usdb_io in the following way
: …
: memcpy(wheel->ep_out_buf, init1, 15);
: usbd_setup_interrupt( wheel->urb, URB_DIR_OUT, wheel->ep_out_buf, 15 );
: if( status = usbd_io( wheel->urb, wheel->ep_out, NULL, wheel,
: USBD_TIME_INFINITY ) ) {
: return( status );
: }
Are you using a separate URB for the In and Out Endpoint ?
: After returning from the above and the write function, there is no
effect to
: the device. In addition, I get blocked by calling the read function
: afterward. What am I doing wrong? Thank you for advice.
sonic (sonic@sonicteam.co.jp) wrote:
: yes, I am using separate endpoints. wheel->ep_out and wheel->ep_int
My question was more related the allocated URB that gets passed in the
the calls to usbd_setup_interrupt() and usbd_io. Are you using the same
allocated URB for both interrupt In and Out transacations. (wheel->urb)
sonic (> sonic@sonicteam.co.jp> ) wrote:
: yes, I am using separate endpoints. wheel->ep_out and wheel->ep_int
My question was more related the allocated URB that gets passed in the
the calls to usbd_setup_interrupt() and usbd_io. Are you using the same
allocated URB for both interrupt In and Out transacations. (wheel->urb)
It 's work now. Thank you.
By the way, I would like to ask why we need to a buffer allocated by
usbd_alloc() ? What 's the problem if not using it? Also, can we set the
usbd-io to be blocking?
My question was more related the allocated URB that gets passed in the
the calls to usbd_setup_interrupt() and usbd_io. Are you using the same
allocated URB for both interrupt In and Out transacations. (wheel->urb)
: By the way, I would like to ask why we need to a buffer allocated by
: usbd_alloc() ? What 's the problem if not using it?
usbd_alloc is used that the USB stack can do quick translations of the
client buffer from virtual to physical addresses. Physical addresses
for a client buffer are given to the USB chip for it put data coming
from a device.
Does using usbd_alloc cause you problems? ie. Are you required to use
memory from a specific memory pool ?
: Also, can we set the : usbd-io to be blocking?
We do not support this.
You can achieve this in your class driver by providing the neccessary
callback to usbd_io and using pthread_sleepon_wait() and in your callback
using pthread_sleepon_signal().
: By the way, I would like to ask why we need to a buffer allocated by
: usbd_alloc() ? What 's the problem if not using it?
usbd_alloc is used that the USB stack can do quick translations of the
client buffer from virtual to physical addresses. Physical addresses
for a client buffer are given to the USB chip for it put data coming
from a device.
Does using usbd_alloc cause you problems? ie. Are you required to use
memory from a specific memory pool ?
: Also, can we set the : usbd-io to be blocking?
We do not support this.
You can achieve this in your class driver by providing the neccessary
callback to usbd_io and using pthread_sleepon_wait() and in your
callback
using pthread_sleepon_signal().