Re: problem FILL_CONTROL_URB

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Navtez Singh (be00078@bbsbec.org) wrote:
> i wrote a function as follows:
> 
> /*structure: */
> 
> struct usb_IrDA {
> 	struct usb_device *	udev;			/* save off the usb device pointer */
> 	struct usb_interface *	interface;		/* the interface for this device */
> 	char			num_bulk_in;		/* number of bulk in endpoints we have */
> 	char			num_bulk_out;		/* number of bulk out endpoints we have */
> 
> 	unsigned char *		bulk_in_buffer;		/* the buffer to receive data */
> 	int			bulk_in_size;		/* the size of the receive buffer */
> 	__u8			bulk_in_endpointAddr;	/* the address of the bulk in endpoint */
> 
> 	unsigned char *		bulk_out_buffer;	/* the buffer to send data */
> 	int			bulk_out_size;		/* the size of the send buffer */
> 	struct urb *		write_urb;		/* the urb used to send data */
> 	struct urb *		read_urb;		/* the urb used to recieve data */
> 	struct urb *		ctrl_urb;		/* the urb used to perform control operations */
> 	unsigned char*			setup_packet;
> 	__u8			bulk_out_endpointAddr;	/* the address of the bulk out endpoint */
> 
> 	int			open_count;		/* number of times this port has been opened */
> 	struct semaphore	sem;			/* locks this structure */
> 	unsigned char *ctrl_buf; /* conrol buffer: for sending control messages */
> };
> 
> 
> /*function:*/
> 
> static int stir_write(struct usb_IrDA *IrDA_dev, unsigned short reg,
> unsigned char value)
> {
> 	int ret;
> 	FILL_CONTROL_URB(IrDA_dev->ctrl_urb, IrDA_dev->udev,
> 		      usb_sndbulkpipe(IrDA_dev->udev, IrDA_dev->bulk_out_endpointAddr),
> 		      IrDA_dev->setup_packet,value,1,
> 		      IrDA_write_ctrl_callback, IrDA_dev);
> 
> 	ret=usb_submit_urb(IrDA_dev->ctrl_urb);
> 
> return ret;
> }
> /* end of function */
> 
> /* this function has been called continously four times, but not in loop*/
> 
> 
> it doesn't work ... i dont why ?

It doesn't work ? doesn't compile ?
Does your urb is allocated ??
Does the length of the transfer buffer shouldn't be a sizeof(value) ?

-- 
Amicalement

Christophe 

* GNU/Linux & UNIX developer and network administrator
* Membre RotomaLUG (http://www.rotomalug.org)
* Registered User #271267
* Email: c.lucas@ifrance.com
* Web Site: http://odie.mcom.fr/~clucas/

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux