power profiling ( /proc/acpi/processor .. missing)
Hi, I am trying to do power profiling of my laptop (DELL LATITUDE) where i am using ubuntu 11.10. For this i m using powertop and acpitool but unfortunately i am not able to get C and P states. when i run `acpitool -c` it says Function Show_CPU_Info : could not read directory /proc/acpi/processor/ Make sure your kernel has ACPI processor support enabled. I have already check the config file ACPI_PROCESSOR is enable(in kernel). So do i require to install any specific driver to get C and P states. For information i m using kernel version 3.0.0-12-generic. -- Pankaj SIngh Phone No: 9921865080 ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
sample USB Driver / Probe not getting called
Hi All, Is there any way to call a sample USB driver whenever a USB device is attached to the system irrespective of the class and type of the device? To do this, LDD3, chap 13 mention that for USB device table, we only need to add the driver_info entry as 42. However if I do this, my probe is never getting called. Now, I give the vendor and product id of this Mouse to the device_id table and load my driver again. Still the probe is not getting called. Is it that USB core is getting the proper driver for this mouse before my driver entry in the list? Am I missing something? Regards, Abhijit Pawar ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
calculating ring buffer size
Hi , While going through a few usb drivers code , i observed that the drivers maintain a ring buffer which stores data coming from usb device in interrupt context . Also these ring buffers is a power of 2 size i am looking for reasons how to compute the the max size of these ring buffers , so that no overflow situation happens . What factors should always be accounted while computing the max size of these ring buffers . Regards Amit Nagal ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: sample USB Driver / Probe not getting called
On 10/17/2011 04:08 PM, selvamuthukumar v wrote: On Mon, Oct 17, 2011 at 3:05 PM, Abhijit Pawarapawar.li...@gmail.com wrote: Hi All, Is there any way to call a sample USB driver whenever a USB device is attached to the system irrespective of the class and type of the device? To do this, LDD3, chap 13 mention that for USB device table, we only need to add the driver_info entry as 42. However if I do this, my probe is never getting called. Now, I give the vendor and product id of this Mouse to the device_id table and load my driver again. Still the probe is not getting called. Is it that USB core is getting the proper driver for this mouse before my driver entry in the list? Am I missing something? probe function will get called only if no other driver is attached to the device. Make sure the device does not have any other driver. Please refer line 290 and 291. drivers/base/dd.c: 270 static int __driver_attach(struct device *dev, void *data) 271 { 272 struct device_driver *drv = data; 273 274 /* 275 * Lock device and try to bind to it. We drop the error 276 * here and always return 0, because we need to keep trying 277 * to bind to devices and some drivers will return an error 278 * simply if it didn't support the device. 279 * 280 * driver_probe_device() will spit a warning if there 281 * is an error. 282 */ 283 284 if (!driver_match_device(drv, dev)) 285 return 0; 286 287 if (dev-parent)/* Needed for USB */ 288 device_lock(dev-parent); 289 device_lock(dev); 290 if (!dev-driver) 291 driver_probe_device(drv, dev); Thanks for reference to this function. It seems that there isnt any way to override the already attached driver to the device. Is there any? Regards, Abhijit Pawar ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: calculating ring buffer size
On Mon, Oct 17, 2011 at 03:31:02PM +0530, Amit Nagal wrote: Hi , While going through a few usb drivers code , i observed that the drivers maintain a ring buffer which stores data coming from usb device in interrupt context . Also these ring buffers is a power of 2 size i am looking for reasons how to compute the the max size of these ring buffers , so that no overflow situation happens . What factors should always be accounted while computing the max size of these ring buffers . Test your device, and your driver, with different values and determine what is the best size. It's not that hard to do. greg k-h ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Question about USB gadget driver usage
Hi We have linux-2.6.35 based device. Device has removable SD-card, which by certain condition is shared to PC vis USB connection using g_file_storage driver. Everything if fine, but when I manualy eject sd-card from cardholder, on my linux host machine, sd-card partition is still being mounted. In sources, there is a note, that if pass 'removable' parametr to g_file_storage module, locations specified by 'file' argument could be unmounted from sysfs by writing zero string to 'file'. But when try to do so, removal attempt is rejected in drivers/usb/gadget/storage_common.c:fsg_store_file() by first if-condition. 755 if (curlun-prevent_medium_removal fsg_lun_is_open(curlun)) { 756 printk(eject attempt prevented\n); 757 return -EBUSY; /* Door is locked */ 758 } As far as I understand, my host-pc blocks driver to eject certain LUN. Here is my parametrs to insert module insmod /lib/modules/g_file_storage.ko stall=0 removable=1 file=/dev/mmcblk0p4,/dev/mmcblk1p1 ro=0,0 where /dev/mmcblk0p4 is device internal memory (chip is soldered to pcb, so it can not be ejected) and /dev/mmcblk1p1 is removable sd-card Is there any way to perform `force eject` for one of my LUNs ? Thank you ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Getting 'bad file number' error writing to device driver
On Mon, Oct 17, 2011 at 6:49 PM, Philip Anil-QBW348 anil.phi...@motorolasolutions.com wrote: -Original Message- From: Daniel Baluta [mailto:daniel.bal...@gmail.com] Sent: Saturday, October 15, 2011 3:34 AM To: Philip Anil-QBW348 Cc: kernelnewbies@kernelnewbies.org Subject: Re: Getting 'bad file number' error writing to device driver On Sat, Oct 15, 2011 at 2:42 AM, Philip Anil-QBW348 anil.phi...@motorolasolutions.com wrote: I am calling the driver from an Android program (OMAP4/Blaze). It calls a c++ program via JNI which then calls the device driver. Someone suggested it might be a permissions problem - the program is running in user mode. on Blaze board, /system/bin # ls -l -rwxrwxrwx system system 7636 2011-09-30 03:53 mydriver Will strace still be useful? In general, in Linux, how does one enable a user program to call a custom device driver? Please don't top post! :) strace will be useful to check the parameters for open, write system calls. EBADF fd is not a valid file descriptor or is not open for writing. Ok, so either open fails, or you don't have the permission to write into /dev/mydriver file. -- I apologize for 'top-posting' (I did not know that was undesirable - most email clients and also Google newsgroups put one's reply at the top.). Yes, the /dev/mydriver had permissions 600. I did a chmod to 666 and it worked. I am performing security testing and want to see if a program running in user mode can elevate its privileges to call the device driver which has permissions 600. Any ideas how it can? Anil Maybe setuid bit can help you ([1]). When this bit is set, a certain program can run with the privileges of its owner. thanks, Daniel. [1] http://en.wikipedia.org/wiki/Setuid ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Linux System Calls vs writing device drivers
Hello, Also would like to know if one needs to work on a Hardware toolkit as well for LDD Thanks for sharing the useful article link www.quora.com/Linux/Whats-the-best-way-to-learn-device-driver-development-on-Linux Regards Ashok --- On Sun, 16/10/11, Javier Martinez Canillas martinez.jav...@gmail.com wrote: From: Javier Martinez Canillas martinez.jav...@gmail.com Subject: Re: Linux System Calls vs writing device drivers To: Ashok Sharma ak...@yahoo.co.uk Cc: kernelnewbies kernelnewbies@kernelnewbies.org Date: Sunday, 16 October, 2011, 17:46 On Sat, Oct 15, 2011 at 4:26 PM, Ashok Sharma ak...@yahoo.co.uk wrote: Hello, I am interested in writing Linux device drivers (DD) and have knowledge of OS concepts, Linux OS design and System Calls. What is the path to writing DD and please give some references/links. Thank you and regards Ashok ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies Hello Ashok, A few days ago I wrote a lengthy answer to the same question in quora, if you want to take a look: www.quora.com/Linux/Whats-the-best-way-to-learn-device-driver-development-on-Linux Short answer: If you have an Android device, there is a big probability that the drivers for that hardware have not yet been pushed upstream. Android and Linux differ slightly but enough to force a developer to choose to write a driver either for Android or Linux. So, a useful contribution and an excellent learning process could be porting Android device drivers to Linux. -- Javier Martínez Canillas (+34) 682 39 81 69 Barcelona, Spain -Inline Attachment Follows- ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
How can I test if a physical address is already mapped or not.
Hi all, In a kernel module is there a way to test if an address range has been already mapped by the kernel or not. Ex: (on a PC with the latest kernel) - an access to physical 0xC000 will return the value at this address - an access to physical 0x0010 will have the kernel kill the module/application using the module. Dmesg: BUG: unable to handle kernel paging request at 0010. How can I test this condition before dereferencing the address. Thanks, Stephan. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Problem with a UDP server implements
Bernd: Is it to create a SOCK_RAW socket for receieve and send? Then is it means I have to parse the IP header and options if any? Will it cause performance problem, compare to SOCK_DGRAM? Thanks. 2011/10/15 Bernd Petrovitsch be...@petrovitsch.priv.at: On Sam, 2011-10-15 at 01:51 +0800, jiangtao.jit wrote: Hi: I'm writing a UDP server and meet a problem the UDP server program is run on a box with single card but has multi ip: like eth0 10.0.0.1 eth0:1 10.0.0.2 eth0:2 11.0.0.1 I bind the server socket with INADDR_ANY when a client send a packet to 10.0.0.2(the eth0:1 's ip) the server can recieve the packet and reply, but the client can't recieve the server's response I use wireshark to capture the response packet and found that the server use 10.0.0.1(the eth0 's ip) as saddr in the response packet I expected it to be 10.0.0.2 but it's not my question : is there any way to let the UDP server relpy just use the ip it receieved the request ? It's : when a client send a request to 10.0.0.1(eth0); the server use 10.0.0.1 to response and another client send a request to 10.0.0.2(eth0:1); the server use 10.0.0.2 to response You can always build the complete raw packet (including the IP header) yourself. Bernd -- Bernd Petrovitsch Email : be...@petrovitsch.priv.at LUGA : http://www.luga.at ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Heap memory is not re-claiming.
On Sat, Oct 15, 2011 at 9:31 AM, Mulyadi Santosa mulyadi.sant...@gmail.comwrote: Hi :) On Fri, Oct 14, 2011 at 16:15, pankaj singh psingh@gmail.com wrote: Nice doc ...:) On Fri, Oct 14, 2011 at 10:28 AM, rohan puri rohan.pur...@gmail.com wrote: Reference to an article by Mulayadi Santosa :- http://linuxdevcenter.com/pub/a/linux/2006/11/30/linux-out-of-memory.html AWESOME ARTICLE SIR :) Thank you, thank you very much for your appreciation :) I just hope, besides getting adequate money, you all got something meaningful from that article. And I believe, as long as there are people who have same concerned, that article will be refined over and over and overall will be better through the time :) -- regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies Hi, It's really a fabulous article. Many many thanks to Mulyadi for such a great article and thank for Rohan for sharing the link. I read the article and correlate contents with my current issue. Here are my observations. Do please correct me if I'm wrong at any point. The leak which I was observed in my program is due to big memory buffers of size 5MB allocation from heap.I've 6 such character buffers. So as per below lines from the article memory should be allocated with mmap and it immediately releases memory to kernel upon free/delete call from user land process. The allocator uses two functions to get a chunk of memory from the kernel: - brk() sets the end of the process's data segment. - mmap() creates a new VMA and passes it to the allocator. The decision on whether to use brk() or mmap() requires one simple check. If the request is equal or larger than M_MMAP_THRESHOLD, the allocator uses mmap(). If it is smaller, the allocator calls brk(). By default, M_MMAP_THRESHOLD is 128KB But It seems I'm landed with a case which uses brk() for allocation and so it just marks as free when I my program frees the memory and hence 30 MB memory (I've 6 , 5MB buffers from heap)was kept on allocator's control leading to a 30MB leak of user land process. Please note that I'm freeing memory for 6 buffers (I'm sure about that). Regards, Ravi ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: How can I test if a physical address is already mapped or not.
On Tue, Oct 18, 2011 at 1:34 AM, StephanT stman937-linew...@yahoo.com wrote: Hi all, In a kernel module is there a way to test if an address range has been already mapped by the kernel or not. Ex: (on a PC with the latest kernel) - an access to physical 0xC000 will return the value at this address - an access to physical 0x0010 will have the kernel kill the module/application using the module. Dmesg: BUG: unable to handle kernel paging request at 0010. How can I test this condition before dereferencing the address. Thanks, Stephan. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies When you say an access to physical address, how are you managing to access the physical address directly? ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies