i have just started working on USB myDev Device Drivers. I have some
Problem with DevFS.would u pls help me... this driver compiles
successfully and runs successfully but i m unable to create dir using
devfs_mk_dir and register with defs_register. I have also read rubini's
book and ur documentation on "writing usb device drivers" but unable to
find error. I m using RH9.0 and kernel version 2.4.
 This Code is like this :

 1. Header Files :

#define MODULE
#define __KERNEL__
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/devfs_fs_kernel.h>
#include <linux/usb.h>
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/signal.h>
#include <linux/poll.h>
#include <linux/init.h>
#include <linux/config.h>
#include <linux/fcntl.h>
#include <linux/spinlock.h>
#include <linux/smp_lock.h>

 2. static struct file_operations myDev_fops = {

        owner:                THIS_MODULE,
        read:                myDev_read,
        write:                myDev_write,
        ioctl:                myDev_ioctl,
        open:                myDev_open,
        release:        myDev_release,
};


 3. static struct usb_driver myDev_driver = {
        name:                "Sigmatel_myDev_driver",
        probe:                myDev_probe,
        disconnect:        myDev_disconnect,
        fops:                &myDev_fops,
        minor:                USB_myDev_MINOR_NO,/*200*/
        id_table:        myDev_table,
};

 4. extern devfs_handle_t usb_devfs_handle;
devfs_handle_t myDev_devfs_dir;

 5. static void* myDev_probe(struct usb_device *udev, unsigned int ifnum,
const struct usb_device_id *id)
{
        struct usb_myDev *dev = NULL;
        .
        .
        .
        .

        int buffer_size;
        int i;
        char name[10]; /*Name of the node using devfs*/
        .
        .
        .
        .
        .
        .

        /* initialize the devfs node for this device and register it */
        /*sprintf(name, "USBmyDev");*/
        /******************** Commented section ********************
                USB_MAJOR is defined as 180 in usb.h*/
        /*
        dev->devfs=devfs_register(NULL,"usbmyDev",
                                     DEVFS_FL_DEFAULT, USB_MAJOR,
                                     200,
                                     S_IFCHR | S_IRUSR | S_IWUSR |
                                     S_IRGRP | S_IWGRP | S_IROTH,
                                     &myDev_fops, dev);
        /***********************************************************/
        myDev_devfs_dir=devfs_mk_dir(NULL,"usbmyDev",NULL);
        if(!myDev_devfs_dir)
        {
        info("unable to make directory");
        }
        usb_devfs_handle = devfs_register(myDev_devfs_dir, "usbmyDev",
                                     DEVFS_FL_AUTO_DEVNUM,0,0,
                                     S_IFCHR | S_IRUGO | S_IWUGO,
                                     &myDev_fops, NULL);
        dev->devfs=usb_devfs_handle;

        /* let the user know what node this device is now attached to */
        if(dev->devfs > 0)
        {
                info("Yes Registered...");
        }
        else
        {
                info("Error Occured...");
        }
        info("Sigmatel's USB myDev device now attached to USBmyDev");
        goto exit;

error:
        myDev_delete(dev);
        dev = NULL;

exit:
        return dev;
}

---------------- End Of Code -------------------


Would u pls specify what is the problem?

regards,
navtez






-----------------------------------------
Baba Banda Singh Bahadur Engineering College
Fatehgarh Sahib, Punjab, India
http://www.bbsbec.ac.in
http://www.bbsbec.org




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to