On Mon, 2 Oct 2006, Lisa Ray wrote:

> Hi Alan
> 
> Please do refer my mail trails below or immediate previous message
> Linux kernel version : 2.6.11.17 

You might find that things work better if you upgrade to 2.6.18.

> In continuation of my previous message: -
> 
> Latest Update
> ---------------
> - I added my read and write functionality in usb_hid_configure() as follows
> 
> static struct hid_device *usb_hid_configure(struct usb_interface *intf)
> {
>       struct usb_host_interface *interface = intf->cur_altsetting;
>       struct usb_device *dev = interface_to_usbdev (intf);
>         char opacket[10] = {0x01,0x04,'C','v',0x05,0x00};   

...

>                       if (hid->urbout)
>                               continue;
>                       if (!(hid->urbout = usb_alloc_urb(0, GFP_KERNEL)))
>                               goto fail;
>                         printk(KERN_ERR "..TELE_TALK CONFIGURE write 
> endpoint:: 0x%04x", endpoint->bEndpointAddress);

You need to learn to put '\n' characters at the end of your printed 
strings.

>                         memcpy(hid->outbuf,&opacket,6);

I'm surprised your system didn't crash the moment this line was executed.  
hid->outbuf hasn't been defined yet.

>                       pipe = usb_sndintpipe(dev, endpoint->bEndpointAddress);
>                         hid->outbuf = usb_buffer_alloc(dev, 10,GFP_KERNEL, 
> &hid->urbout->transfer_dma);
>                         if( !hid->outbuf ) 
>                         {
>                          printk(KERN_ERR "%s Unable to allocate buffer ", 
> __func__ );
>                          goto fail ;
>                       }
>                       usb_fill_int_urb(hid->urbout, dev, pipe, hid->outbuf, 6,
>                                        hid_irq_out, hid, interval);
>                       hid->urbout->transfer_dma = hid->outbuf_dma;
>                       hid->urbout->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
>               }
>       }
> 
>       if (!hid->urbin) {
>               err("couldn't find an input interrupt endpoint");
>               goto fail;
>       }
> 
>       init_waitqueue_head(&hid->wait);
>         ... 
>         ...
> }
> 
>    
> 
> I am getting following ERROR messages in log files....
> 
> 
> 
> -----------/var/log/messages------------------------------
> Oct  2 14:48:03 lisa kernel: hiddev96: USB HID v1.11 Device [LISA COIN HID 
> MACHINE.] on usb-0000:00:1d.1-2
> Oct  2 14:48:04 lisa kernel: usb 3-2: USB disconnect, address 3
> Oct  2 14:48:07 lisa kernel: usb 3-2: new full speed USB device using 
> uhci_hcd and address 4
> Oct  2 14:48:07 lisa kernel: usb 3-2: Product: LISA COIN HID MACHINE.
> Oct  2 14:48:07 lisa kernel: usb 3-2: SerialNumber: 0.0.1
> Oct  2 14:48:07 lisa kernel: usb 3-2: configuration #1 chosen from 1 choice
> Oct  2 14:48:12 lisa wait_for_sysfs[9512]: either wait_for_sysfs (udev 039) 
> needs an update to handle the device 
> '/devices/pci0000:00/0000:00:1d.1/usb3/3-2/3-2:1.0' properly (no bus device 
> link) or the sysfs-support of your device's driver needs to be fixed, please 
> report to <[EMAIL PROTECTED]>
> Oct  2 14:48:17 lisa kernel: ..lisa_TALK CONFIGURE write endpoint:: 
> 0x0002<3>drivers/usb/input/hid-core.c: usb_submit_urb(ctrl) failed

That message is the first major error.  And it has nothing to do with your 
code.  Not surprising, really, since your hid_lisa_write() never got 
called.

By the way, you'll get a lot more debugging information if you set 
CONFIG_USB_DEBUG.

> Oct  2 14:48:17 lisa kernel: drivers/usb/input/hid-core.c: timeout 
> initializing reports
> Oct  2 14:48:17 lisa kernel: hiddev96: USB HID v1.11 Device [LISA COIN HID 
> MACHINE.] on usb-0000:00:1d.1-2
> ---------------------------------------------------------------
> 
> 
> Regards
> Lisa Ray

> Oct  2 11:58:06 lisa kernel: usbcore: registered new driver hiddev
> Oct  2 11:58:06 lisa kernel: hiddev96: USB HID v1.11 Device [HID MACHINE.] on 
> usb-0000:00:1d.1-2
> Oct  2 11:58:06 lisa kernel: ..lisa_TALK write called<7>usb 3-2: bogus 
> endpoint ep2out in usb_submit_urb (bad maxpacket 0)

I don't know why this failed.  But you have all the source code, so you 
should be able to figure it out for yourself.  That "bogus endpoint" 
message is in drivers/usb/core/urb.c:usb_submit_urb().  Add in your own 
printk statements to find out what's going wrong.

> Oct  2 11:58:06 lisa kernel: ..lisa:: write failed.. usb_submit_urb 
> failed<7>usb 3-2: bogus endpoint ep1in in usb_submit_urb (bad maxpacket 0)
> Oct  2 11:58:06 lisa kernel: ..lisa:: READ failed.. usb_submit_urb 
> failed<6>usbcore: registered new driver usbhid
> Oct  2 11:58:06 lisa kernel: drivers/usb/input/hid-core.c: v2.6:USB HID core 
> driver

> void hid_lisa_write()
> {
>     struct hid_device *hid = myhid ;
>     struct usb_device *dev = mydev ;
>     int pipe ;
>     char opacket[10] = {0x01,0x04,'C','v',0x05,0x00};
> 
>     printk(KERN_ERR "..lisa_TALK write called");
>     //lets write
>     hid->urbout = usb_alloc_urb(0, GFP_KERNEL) ;

Why do you allocate a second URB when hid_configure() has already 
allocated one for you?

>     pipe = usb_sndintpipe(dev, 0x02);
> 
>     hid->outbuf = usb_buffer_alloc(dev, 10,GFP_KERNEL, 
> &hid->urbout->transfer_dma);
>     if( !hid->outbuf )
>     {
>         printk(KERN_ERR "%s Unable to allocate buffer ", __func__ );
>         return ;
>     }

Why do you allocate a second buffer when hid_configure() has already 
allocated one for you?

>     memcpy(hid->outbuf,&opacket,6);
>     usb_fill_int_urb(hid->urbout, dev, pipe, hid->outbuf, 6,hid_irq_in, hid, 
> 50) ;
>     hid->urbout->transfer_dma = hid->outbuf_dma;
>     hid->urbout->transfer_flags |= URB_NO_TRANSFER_DMA_MAP ;
>     spin_lock_init(&hid->urbout->lock) ;
> 
>     if (usb_submit_urb(hid->urbout,GFP_ATOMIC))
>         printk(KERN_ERR "..lisa:: write failed.. usb_submit_urb failed");
>     else
>         printk(KERN_ERR "..lisa:: write SUCESS usb_submit_urb");
> 
>     return ;
> }

Alan Stern


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to