Re: device emulator?

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

 



On Sat, 13 Aug 2011, Chris Furlough wrote:

> Greg, please take this at face value, and tell me if you know what the 
> problem is here.
> 
> * I'm calling fs_create_file to register my node under my parent directory. 
> (I get the address from kallsyms, and call it directly).[1]
> * My node shows up in "ls", and I can cat my data from it.[2]
> * My test program uses libusb-0.1.12, and does the following:
>     usb_init();
>     usb_find_busses();
>     usb_find_devices();
> 
> * Using strace on my test program, I can see that when usb_find_devices() 
> checks the directory my new node is it, it doesn't see it.[3]
> * Digging into usb_find_devices, I see that it's calling readdir() to 
> enumerate the items in the directory.[4]
> * According to what strace tells me, readdir is calling getdents().[3]
> 
> ANY idea why my node wouldn't show up?
> 
> 
> Notes:
> 1.  I get usbfs_mount, and get the root dentry from it, then walk the linked 
> list to find my desired parent directory using this:list_for_each_entry(tmp,&parent->d_subdirs, d_u.d_child).
> 2. ls /proc/bus/usb/005/ -a
> .  ..  001  002  003
> 
> 3. open("/dev/bus/usb/005", 

Here's the problem.  Your file node is located under 
/proc/bus/usb/005, but the program is looking in /dev/bus/usb/005.

/proc != /dev.

> O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
>     getdents(3, /* 4 entries */, 32768)     = 64
> 
> 4. File linux.c, line 380:   while ((entry = readdir(dir)) != NULL) {

Alan Stern

--
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