On Fri, Nov 01, 2002, Stuart Tett <st...@cs...> wrote:
> There's a problem i've been having with the libipc with my usb mp3 player. To
> get a list of tracks the program it first calls the function below ipc_open.
> Then it calls ipc_close() when done, which calls usb_reset(). The second time
> I run the tracks program no output is shown. The developer of the project
> thought he used the usb_reset() in the wrong situation. I tried removing it,
> but then it seemed to lock up and killing wouldn't work. I had to rmmod, then
> modprobe usb-uhci for usbview to see my mp3 player again. Any ideas?
usb_reset is almost definately not appropriate. It should only be used
for broken devices and if you really need to reset the device for things
like firmware uploads, etc.
> see http://sourceforge.net/projects/intelpcmp/ for libipc project.
>
> int ipc_open (ipc_t *ipc)
> {
> if ( (ipc->dev= usb_open(ipc->device)) == NULL ) {
> return -1;
> }
>
> if ( usb_set_configuration(ipc->dev, 1) ) {
> return -1;
> }
>
> if ( usb_claim_interface(ipc->dev, 0) ) {
> return -1;
> }
>
> if ( usb_set_altinterface(ipc->dev, 0) ) {
> return -1;
> }
>
> ipc->bulkep= IPC_BULK_EP;
> ipc->tracks= NULL;
> ipc->tcache= IPC_CACHE_DIRTY;
> ipc->ucache= IPC_CACHE_DIRTY;
>
> return 0;
> }
>
>
> int ipc_close (ipc_t *ipc)
> {
> usb_release_interface(ipc->dev, 0);
> #ifdef linux
> usb_reset(ipc->dev);
> #endif
> return usb_close(ipc->dev);
> }
This all looks fine. The calls to usb_set_configuration and
usb_set_altinterface may be superfluous however.
I'm curious to here more about the problems you were having with the
application locking up. There shouldn't be any situation where using
libusb would result in the application being uninterruptible.
What kernel are you using? How reproducible is this? What device is this
with?
JE
|