Re: How to implement the asynchronous notification in the etherdrivers?

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

 



Dear Greg KH:

    Yes, I develop the driver based on the cdc_ether.c. 

    But we use the self command system, which is called 'qmi', to managed our device.

    And the device will have some indications to report to our managed software running in the user space.
    So the driver must notify our managed software to get the indication data from our driver.

    But now I don't know how to implement this asynchronous notification in our ether driver.

    Can you give me any advice or samples for it?

Best Regards,

Franko Fang
2009-3-23
----- Original Message ----- 
From: "Greg KH" <greg@xxxxxxxxx>
To: "fangxiaozhi 00110321" <huananhu@xxxxxxxxxx>
Cc: <gregkh@xxxxxxx>; <linux-usb@xxxxxxxxxxxxxxx>; <zhangqianchun@xxxxxxxxxx>
Sent: Sunday, March 22, 2009 1:56 AM
Subject: Re: How to implement the asynchronous notification in the etherdrivers?


> On Sat, Mar 21, 2009 at 06:10:32PM +0800, fangxiaozhi 00110321 wrote:
>> Dear Greg KH,
>> 
>> I am sorry, I must trouble you again.
>>   
>> I am now developing a new CDC-ECM driver for our device, based on
>> cdc_ether.c (drivers/net/usb/cdc_ether.c).
> 
> Why not just add a few changes to the existing cdc-ether driver instead
> of writing a totally new one?
> 
>> And in our requirement, we want the driver can notify the application
>> in user space with asynchronous notification, while the
>> USB_CDC_NOTIFY_RESPONSE_AVAILABLE  occurs.
> 
> Why not just modify the existing driver to provide such notification.
> It should be a simple change, right?
> 
>> So I want to implement it with the fasync feature in the 'struct
>> file_operations'. I declare them in our CDC-ECM driver as follows:
>>   
>>   static struct fasync_struct *hw_irq_fasync = NULL;
>>   static int hw_ether_fasync(int fd, struct file* filp, int on){
>>   int retval = 0;
>>   retval = fasync_helper(fd, filp, on, &hw_ether_fasync);
>>   if (0 > retval)
>>   return retval;
>>   return 0;
>>   }
>>   static const struct file_operations hw_ether_ops = {
>>   .owner = THIS_MODULE,
>>   .fasync = hw_ether_fasync,
>>   };
>>   
>>   But unfortunately, I don't know how to register 'hw_ether_ops' in our driver, 
>>    static struct usb_driver hw_cdc_driver = {
>> .name = "huawei_driver",
>> .id_table = hw_products,
>> .probe = usbnet_probe,
>> .disconnect = usbnet_disconnect,
>> .suspend = usbnet_suspend,
>> .resume = usbnet_resume,
>> };
>> 
>> Can you tell me how to register it in our driver?
> 
> You don't register file_ops with usb drivers, unless you are willing to
> use the USB major number now.
> 
> As this is a network device, why not just use the existing kernel
> interfaces to provide notifications for network drivers?  Don't create a
> char device, no userspace code is expecting that for a network device.
> 
>> By the way, I also heard that, this asynchronous notification
>> mechanism is used for Char drivers, not for ether drivers.  Is it
>> true? Then how to implement the asynchronous notification in the ether
>> drivers?
> 
> Us the existing network driver interface for this kind of functionality
> :)
> 
> thanks,
> 
> greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux