Re: Convert urb to skbuff
On Mon, Nov 29, 2010 at 05:43:13PM +0530, Bond wrote: On Mon, Nov 29, 2010 at 5:17 PM, sugnan prabhu sugnan.pra...@gmail.com wrote: Hello, I am trying to write a kernel module which is the combination of the usb driver and a network driver, now whenever the data is recieved by the usb driver it will be in struct urb, but the data that is required by the net driver is sk_buff, now how do i convert a urb to sk_buff, My reply is not a direct answer of your question but it might help you to understand. In USB driver the read and write is done via making calls to file operations which are same for character drivers. I.e. the USB end points is some thing you need to understand. For a USB driver the device will be reading and writing to the endpoints. Hence you need to have char driver which can create all this for you. Bond, no, that is totally and completely wrong. Sugnan, just take the buffer passed back to you from your urb and put it into a sk_buff. Look at the existing usb network drivers for examples. good luck, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: and there's a routine for *sorting* a kernel linked list as well
On Sun, Nov 21, 2010 at 02:23:18AM -0500, Robert P. J. Day wrote: what started off as just some nonchalant poking around in kernel data structures has become moderately educational. i had no idea that there is support for *sorting* the nodes of a kernel LL in linux/list_sort.h: void list_sort(void *priv, struct list_head *head, int (*cmp)(void *priv, struct list_head *a, struct list_head *b)); doesn't seem to be a lot of folks using that: It's very new. The drm code needed it, so they took it from the xfs code and made it common code. i wonder how much kernel code manually sorts a linked list, not realizing that there's kernel library support for that. Hopefully none other, if you find some please feel free to convert it to use the core code. thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Pointers for porting a network driver
On Thu, Nov 11, 2010 at 12:30:35PM +0530, Ans_linux wrote: Hello guys, I have custom network device driver working fine with 2.6.20.1 kernel. I am planning to port the driver to Linux-2.6.36 or higher. Why isn't this driver in the main kernel tree? If it is merged then you would not have to do this work. Please get it merged so you will not have to do this again in the future. It will be great if somebody can help me with pointers to network API changes ,data structure changes ,and other stuffs which I need to take care while porting. All of the changes are provided in the kernel git tree with the changes provided there. Just use that and you should be fine. good luck, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Pointers for porting a network driver
A: No. Q: Should I include quotations after my reply? http://daringfireball.net/2007/07/on_top On Fri, Nov 12, 2010 at 01:05:22AM +0530, Ans_linux wrote: Hi Greg, Thanks for the response. I don't really know why the driver left out from mainline kernel. I am planning to merge it once I port it to latest kernel. Have a pointer to the code right now? BTW anybody documents which can help me in porting driver. I am bit new to Linux kernel development. Again, look at the kernel git tree to find the exact changes that have happened during the years since the code was last touched. You will not find an exact document other than that. good luck, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Why to not mark struct pci_driver
On Tue, Nov 02, 2010 at 05:50:33PM +0530, Bond wrote: http://lxr.linux.no/#linux+v2.6.36/Documentation/PCI/pci.txt#L197 What is meant by marking strcut pci_driver as the above link says not to mark it. Don't mark it as __init or __exit or with any other attribute. See the text above the bullet for what the different bullet points are for. thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: looking for corrections/enhancements/omissions for LKD3
On Sun, Oct 31, 2010 at 08:18:52AM -0400, Robert P. J. Day wrote: Also, I saw XIP in ext2 filesystem. Quite neat..but again, why? hmmm ... not sure, i'll look into that. So you can run Linux on a system with very limited amount of ram and your code running in rom or flash. greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: looking for corrections/enhancements/omissions for LKD3
On Mon, Nov 01, 2010 at 11:52:25AM +0700, Mulyadi Santosa wrote: Hi Greg... On Mon, Nov 1, 2010 at 10:21, Greg KH g...@kroah.com wrote: On Sun, Oct 31, 2010 at 08:18:52AM -0400, Robert P. J. Day wrote: Also, I saw XIP in ext2 filesystem. Quite neat..but again, why? ? hmmm ... not sure, i'll look into that. So you can run Linux on a system with very limited amount of ram and your code running in rom or flash. Make senses to me...thanks for the explanation greg. Anyway, why ext3 doesn't have similar feature? Maybe because no one created it yet? thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: where is usb driver file system
On Mon, Nov 01, 2010 at 07:11:52PM +0530, Tapas Mishra wrote: I checked this link http://www.linux-usb.org/USB-guide/x173.html excerpts from above page The USB device filesystem is a dynamically generated filesystem, similar to the /proc filesystem. This filesystem can be mounted just about anywhere, however it is customarily mounted on /proc/bus/usb, whi and went to see /proc/bus but the directories were not there as they have mentioned. Can some one point me to right direction. It's no longer mounted at /proc/bus/usb as it's not needed there anymore. But if you want to, you can mount it anywhere you want: mount -t usbfs none /home/foo/usbfs What do you want to do with it? thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: where is usb driver file system
On Mon, Nov 01, 2010 at 11:23:22PM +0530, Tapas Mishra wrote: On Mon, Nov 1, 2010 at 7:26 PM, Greg KH g...@kroah.com wrote: It's no longer mounted at /proc/bus/usb as it's not needed there anymore. But if you want to, you can mount it anywhere you want: ? ? ? ?mount -t usbfs none /home/foo/usbfs What do you want to do with it? Nothing just learning to write drivers for USB and Network Drivers. You don't need to use usbfs for that, so don't worry about it. thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: USB driver (hello usb driver)
On Mon, Oct 25, 2010 at 08:57:49PM +0530, Bond wrote: On Sun, Oct 24, 2010 at 9:24 PM, Greg KH g...@kroah.com wrote: Yes, look at the hid driver blacklist. so that it checks my driver and if it doesn't find it, then pass it to the usbhid? If your driver is loaded first, yes, you can do that. You can unbind the device from the hid driver by hand through sysfs and then load your driver for testing. Okay, i found my device in /dev/bus/usb/devices/usb6/6-1. When I nano idVendor, i see the correct vendor, and when i nano idProduct, i see the correct product. So it's definately there, but I think the problem is that usbhid is catching it before my module does. how would i unload the device and test like you stated? Use the unbind file in sysfs for the usb hid driver to unbind the device from the driver. good luck, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: USB driver (hello usb driver)
On Sun, Oct 24, 2010 at 09:55:17AM +0530, Bond wrote: On Fri, Oct 22, 2010 at 6:01 AM, Greg KH g...@kroah.com wrote: On Wed, Oct 20, 2010 at 10:49:33PM +0530, Bond wrote: ?So, I got it to recognize the driver in the kernel, but it refuses to probe. No matter that vendor/product id combination I use for any of the devices I've tested. Are you using device ids of existing devices that already have drivers bound to them? ?If so, don't do that :) IT's a game pad so it might be bound to the joystick service? You can see if it is, look in sysfs, or in /sys/kernel/usb/devices is there a way to supercede the usbhid driver? Yes, look at the hid driver blacklist. so that it checks my driver and if it doesn't find it, then pass it to the usbhid? If your driver is loaded first, yes, you can do that. You can unbind the device from the hid driver by hand through sysfs and then load your driver for testing. good luck, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: creating a device special file
On Sun, Oct 24, 2010 at 05:06:31PM +0200, fabio de francesco wrote: I meant to do that from a device driver, not from user space! Userspace is the thing that is creating that device link in the first place through udev. So that is how you need to change this, write a udev rule. thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: USB driver (hello usb driver)
On Wed, Oct 20, 2010 at 10:49:33PM +0530, Bond wrote: So, I got it to recognize the driver in the kernel, but it refuses to probe. No matter that vendor/product id combination I use for any of the devices I've tested. Are you using device ids of existing devices that already have drivers bound to them? If so, don't do that :) good luck, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Laptop extras for unsupported laptop brand
On Mon, Oct 11, 2010 at 10:47:09AM +0300, Ali Polatel wrote: On Sun, 10 Oct 2010 23:43:24 +0700, Mulyadi Santosa mulyadi.sant...@gmail.com wrote: Hi Ali... On Sun, Oct 10, 2010 at 23:09, Ali Polatel a...@exherbo.org wrote: Well xbacklight doesn't work at all on this box: $ xbacklight No outputs have backlight property Great :( Well, perhaps the first thing you need to do is see the complete output of lshw and then discuss it with people like Greg Kroah Hartman. Fortunately, he's in kernelnewbies too :) Adding Greg to CC. Greg, can you help me add support for this laptop? at least pointers about where to start will help greatly. What laptop are you referring to here? And unless you have the specs from the manufacturer, or can do a lot of reverse engineering of the hardware using kvm or vmware, you are going to have a hard time writing a new driver for it. good luck, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Submitting a USB device driver to 2.6 kernel
On Thu, Oct 07, 2010 at 05:50:03PM -0400, Tek Xtc wrote: I have developed a USB driver and tested it with my USB devices. Great, what type of device/driver have you written? I want to submit the file to the kernel source. How do I do this? Read Documenation/SubmittingPatches and send the patch to the linux-...@vger.kernel.org list and cc: the Linux USB maintainer (i.e. me.) thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: where is usb_interface defined
On Sun, Sep 19, 2010 at 11:21:17AM +0530, Bond wrote: On Sun, Sep 19, 2010 at 3:52 AM, Greg KH g...@kroah.com wrote: Also note the age of that presentation, a much newer version can be found on github, along with the code examples. Can you give me a link I am new to all these things I was searching to write device drivers found your USB driver code started understanding that with what ever information I had. http://github.com/gregkh/kernel-tutorial -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: where is usb_interface defined
On Wed, Sep 15, 2010 at 08:56:28AM +0530, Bond wrote: I am trying my hands at usb driver http://www.kroah.com/linux/talks/ols_2005_driver_tutorial/mgp00010.html can some one point me where is struct usb_interface defined. include/linux/usb.h in the kernel source tree. I have going through a lot of lines but I could not find it. I suggest you use a tool like 'grep', 'ack', 'cgvg', 'ctags', or 'cscope' for future questions like this. They are all good at finding where things are in large bodies of code. good luck, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Concurrent accesses to sysfs
On Mon, Sep 06, 2010 at 09:23:06AM +0200, Christophe Aeschlimann wrote: On 04.09.2010 02:58, Greg KH wrote: On Tue, Aug 24, 2010 at 11:52:07AM +0200, Christophe Aeschlimann wrote: Hi, I'm implementing a user-space API that will give access to custom hardware features through sysfs. This library is here to hide the sysfs specifics. Ick, don't. What's wrong with the existing sysfs interfaces we have today, open(), read(), close()? And what type of hardware features are you wanting to export through sysfs? Why sysfs? Well we have to offer a board-support-package to a customer. When I told them about sysfs to access LEDS / GPIOS they told me they wanted some layer above that so they can just call a switch_led_on function and they wouldn't have to know the way sysfs works. E.G. Know the sysfs path name, attributes names and values to write to the attributes to control the device. {sigh} Ok, then write a tiny shell script that does this :) I would like to know if something special must be done in this library to assure concurrent accesses. Here is an example : I want the users of my library to be able to switch-on/-off a LED using a simple function like the following : platform_led_on(0); //switches on led '0' platform_led_off(0); //switches on led '0' This led is declared in my platform_data in the board init file as a gpio_led and can be seen in sysfs under /sys/class/leds/led0 the platform_led_on/off(0) functions will : - build the sysfs path to the led0 based on the argument (0) - open the brightness file in the sysfs path - write to the brightness file a value != 0 to switch the led on or 0 to switch it off - close the brightness file - return Now what will happen if a thread tries to switch on the led while another thread tries to switch it off ? Who ever writes to the file first will cause their action to happen, followed by the action of the second process/thread. What happens with the open() on sysfs pseudo files ? The file descriptor is returned, what exactly are you worried about here? Can the file be opened twice ? Yes, multiple times, try it. Or does it requires a close first ? Nope. If you need locking, do it in your library, but again, this really looks like overkill, why do you need to do all of this? Because it's a customer request :) What type of locking are they asking for? Is it possible to do the locking with the open() or flock() ? Or should I use pthread mutex ? open() isn't going to work. flock() might, haven't tried it though. a mutex would, if you are controling all access through your library. But that's really overkill here, right? Oh, and you have looked at libudev, right? No I wasn't aware of that lib but I guess : udev_device_get_sysattr_value () does the open/read/close for me in a thread-safe way ? Again, what does thread-safe mean here? The above call opens the file and reads the value and then closes the file and returns the value to your program. If someone else went in and wrote to the file right after reading to it, your read will be stale. Which is the same thing that would happen with your mutex lock as well, right? You aren't going to ever be able to conclusivly say, Here is the value, no one else has changed it. So again, I think you are over thinking this a lot. Just wrap up the libudev call if you want, or just point your customer at libudev if they are writing their own programs. Or just write a simple shell script :) good luck, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Crash on reducing the kernel mem.
On Fri, Sep 03, 2010 at 12:04:09PM +0530, Prabhu Chawandi wrote: Hi all, I am using MIPS processor, with 256 MB RAM. currently I am using 128 M for drivers and 128 M for Kernel. I tried to allocate more memory for Drivers, surprisingly I got crash when I reduced kernel memory to 110 M. My debugging took me to USB controller, which was not reset in bootloader. I am not having any clue, why it didnt crash with 128 M ? How reducing memory for kernel bringing it up ? Perhaps your drivers really needed that much memory. How are you splitting memory up between drivers and the kernel when the drivers and kernel all share the same memory areas? good luck, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Concurrent accesses to sysfs
On Tue, Aug 24, 2010 at 11:52:07AM +0200, Christophe Aeschlimann wrote: Hi, I'm implementing a user-space API that will give access to custom hardware features through sysfs. This library is here to hide the sysfs specifics. Ick, don't. What's wrong with the existing sysfs interfaces we have today, open(), read(), close()? And what type of hardware features are you wanting to export through sysfs? Why sysfs? This library must support multi-threaded accesses. sysfs handles that just fine. I would like to know if something special must be done in this library to assure concurrent accesses. Here is an example : I want the users of my library to be able to switch-on/-off a LED using a simple function like the following : platform_led_on(0); //switches on led '0' platform_led_off(0); //switches on led '0' This led is declared in my platform_data in the board init file as a gpio_led and can be seen in sysfs under /sys/class/leds/led0 the platform_led_on/off(0) functions will : - build the sysfs path to the led0 based on the argument (0) - open the brightness file in the sysfs path - write to the brightness file a value != 0 to switch the led on or 0 to switch it off - close the brightness file - return Now what will happen if a thread tries to switch on the led while another thread tries to switch it off ? Who ever writes to the file first will cause their action to happen, followed by the action of the second process/thread. If you need locking, do it in your library, but again, this really looks like overkill, why do you need to do all of this? Oh, and you have looked at libudev, right? thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: how to add anther file format interpreter to the kernel?
On Sat, Jul 10, 2010 at 10:11:45AM +0800, Hei Xia wrote: How does wine do it? The misc interpreter, which is there for whatever you can think of. good luck, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: quilt patch management
On Fri, Jul 02, 2010 at 05:34:55PM +0530, Onkar Mahajan wrote: Please help me with some detailed tutorial on Quit utility. Did you read the quilt documentation? If so, what specifically are you having questions about? thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Which version a patch is added
On Tue, Jun 29, 2010 at 09:21:34AM +0200, Bjorge Solli wrote: Hi, I would like to have a kernel with a specific patch in to my fedora 12 machine, but don't know when this patch was included in the kernel. How can I figure this out? I only have this info: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=patch;h=462d60577a997aa87c935ae4521bd303733a9f2b Try: git describe --contains 462d60577a997aa87c935ae4521bd303733a9f2b that will show you the release that the git commit id was first in. hope this helps, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: How to port linux drivers ftom devfs to udev.
On Mon, Jun 28, 2010 at 10:40:33AM -0700, StephanT wrote: Your Subject is very generic. Well, my subject says I am looking for a migration/port guide. If you have such document I will be very grateful to get a pointer on it. Again, it all depends on the code. Some interfaces have changed radically from the past 8 years, while others, not much at all. Care to post it? thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: How to port linux drivers ftom devfs to udev.
On Wed, Jun 23, 2010 at 03:54:56PM -0700, StephanT wrote: What type of devfs driver? character You shouldn't need to do anything other than the normal 2.4 to 2.6 porting. I don't know what this normal implies. Hence my question. I don't know what problems you are having, hence my question :) Do you have a pointer to the driver you need to have ported? No. If there is interest I can make them public. Please do. People will do this work for you, have you seen the linuxdriverproject.org site? No I haven't seen this site. This would be very nice :-) , but I don't think is doable. Short story: We are using linux 2.4.18 on SH4 architecture. Very specific H/W and very different from PC. Linux is used as configuration manager and user interface (web). All linux drivers are simple char drivers - mainly to get access to FPGA and DSP. Most of them provide a mmap interface to user applications. The original port was done by Montavista. They should have made it public years ago. Yeah, we all know about how well Montavista does when it comes to hiding source, they are wonderful at that :( We are looking what would cost to migrate to 2.6. Boss asked for an effort estimation and I had to start from some point. The pointer I got from Arun cleared the way for me to get some numbers. Most of the migration cost is not in driver port but in how we are going to handle a mixed installed base. Related the the Linux Driver Project. This is a very nice and generous idea ! Not for us - unfortunately. Our work is driven by a schedule. Very tight! We do not have spare H/W and we are not so rich to pay a person to do interface work. It is cheaper to do the work by ourselves and we need to learn to be able to maintain/modify/enhance. Ok, feel free to ask questions. But your drivers can get merged, there's no reason to keep them out of the tree anymore, we'll take anything :) For cases like ours would be very, very useful if you, guys would update and print LDD V4. I can guarantee we will buy at least five copies. The wheels on this are slowly moving, but it will be a long time. So, feel free to post the code and we can see how hard it would be to get it up and working on the latest 2.6 kernel? If it's just a char device, it shouldnt' be very hard. thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: How to port linux drivers ftom devfs to udev.
On Thu, Jun 10, 2010 at 01:27:05PM -0700, StephanT wrote: Hello, Is there any User Guide, Tutorial, FAQ, example which explains how to port a 2.4 devfs driver to a 2.6 udev one. What type of devfs driver? You shouldn't need to do anything other than the normal 2.4 to 2.6 porting. Do you have a pointer to the driver you need to have ported? People will do this work for you, have you seen the linuxdriverproject.org site? thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Read block level storage via kernel modules
On Sun, Apr 25, 2010 at 08:08:12AM +0530, Naval wrote: Thank you very much for replying, I really appreciate your help. Like the one in the kernel already? Yes. But i am really unable to figure out how kernel does that. Read the source to the driver in the kernel that does exactly this already (hint, it's in drivers/block/nbd.c) and you will see how this works. The request will be received by a server program (user space program) and then it has to somehow delegate the request to kernel (i think writing a module and a system call myself?). The kernel would access the block device and return the data which server would pass to the client which initiated the request. That's much like iscsi as others have pointed out. If you wish to reimplement something already done, then look at how those groups did it, the code is all open. That is because it does not accept html email. Please fix your client and resend. Sorry, but I have no idea about such clients. Can you please name one? Your email client (what you use to send email with). If it's gmail, go change the settings on it. good luck, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Read block level storage via kernel modules
On Sun, Apr 25, 2010 at 01:34:01AM +0530, Naval wrote: Sir, My intent is to implement a block level storage protocol over network for learning purpose, almost the same way SCSI works. Requests will be generated by initiator and sent to target (both userspace program) which makes call to kernel module and returns the data using TCP protocol to initiator. Like the one in the kernel already? P.S.: 1. Mailing to linux-ker...@vger.kernel.org results in mail delivery failure That is because it does not accept html email. Please fix your client and resend. good luck, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: USB detection
On Sun, Feb 14, 2010 at 08:05:00AM +0530, Anoop wrote: Hi Greg, Thanks for reply. On Sat, Feb 13, 2010 at 10:02 PM, Greg KH g...@kroah.com wrote: On Wed, Feb 10, 2010 at 09:46:42PM +0530, Anoop wrote: Hi List, My system has two USB ports. And I want to know, what is the way to find, to which USB port the device is plugged in. Moreover what type of device is it. Can I figure this out from kspace? You want to determine this from another kernel module? ?What is the problem you are trying to solve here? My target has two USB ports. I want to write a user space application through which I want to provide a interface to user, from where he can mount/unmount the device. Also depending upon the device plugged in, I want to provide services to the user. Then you do not need to detect this from within the kernel as you originally asked, just use udev to notify you of changes here. Just like HAL does this already today. hope this helps, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: USB detection
On Wed, Feb 10, 2010 at 09:46:42PM +0530, Anoop wrote: Hi List, My system has two USB ports. And I want to know, what is the way to find, to which USB port the device is plugged in. Moreover what type of device is it. Can I figure this out from kspace? You want to determine this from another kernel module? What is the problem you are trying to solve here? thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Sysfs Device Attributes: Subdirectory under subdirectory
On Sat, Jan 30, 2010 at 07:24:27PM +0530, Himanshu Chauhan wrote: Sorry, I am not quite able to digest this :( Do the USB ports on a system have representation in sysfs? Um, you can look to see if they do, right? :) Hint, no they do not. If they do, does each port has a subdirectory of its own? Nope. When I say VHCI ports, I am refering to same kind of USB ports that we have on a system to which USB devices can connect. The difference being the devices attached on VHCI ports are over IP. Ah, that's what vhci is, sorry, forgot about usb-ip. Then you are just fine, use the usb code and you should not have to add any new support for stuff like this. With USB, you have a representation in sysfs for the devices that are attached to the USB bus, which then shows the actual port the device is connected to. The following is the output of /sys/devices/platform/vhci_hcd/status file. prt sta spd bus dev socket local_busid 000 004 000 000 000 0-0 001 004 000 000 000 0-0 002 004 000 000 000 0-0 003 004 000 000 000 0-0 004 004 000 000 000 0-0 005 004 000 000 000 0-0 006 004 000 000 000 0-0 007 004 000 000 000 0-0 That's wrong :) You should move that to debugfs if you need to watch the status of things. As you can see, I am trying to divide this output in a way that I can group sta, spd, bus, dev, socket, local_busid as files under ports[N] directory under /sys/devices/platform/vhci_hcd/status I don't think you need this except for debugging stuff, so put it in debugfs instead, like the other usb files in debugfs for host controllers. I think ports cannot be taken as devices and have their representation in sysfs. But I believe they can very well be put under vhci_hcd directory as /sys/devices/platform/vhci_hcd/status/port[N]/attributes Why, who needs to know this information? regular users? thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Sysfs Device Attributes: Subdirectory under subdirectory
On Fri, Jan 29, 2010 at 09:41:21AM +0530, Himanshu Chauhan wrote: On Thu, Jan 28, 2010 at 01:11:36PM -0800, Greg KH wrote: On Fri, Jan 29, 2010 at 12:12:31AM +0530, Himanshu Chauhan wrote: Dear all, I want to create subdirectory under subdirectory in sysfs for a device. Ick, don't. For example, if vhci_hcd is my device I want the following hierarchy: vhci_hcd | +-- status | +---0 || |+-- status || |+-- speed || |+-- device id || |+-- socket || |+-- busid | +---N | +-- status | +-- speed | +-- device id | +-- socket | +-- busid No, you really do not want this. Why do you feel that you would want to create something that does not fit into the current driver/device model of the kernel? In short, what specifically are you trying to convey here? There are 8 ports exported by VHCI. What is 'vhci'? What do you do with a port? So I want to group the attributes of each port together. 0 to N are the port numbers. All attributes of port zero will be under 0 and all attributes of port 1 will be under 1 and so on. So then make each port a device on your bus. Then the topology automatically happens for you, no need to mess with raw kobjects at all (which you shouldn't be doing in the first place.) Can devices be plugged into ports? So, how do I create subdirectories 0 to N under status? I created attribute groups from 0 to N, how do I attach it to status and then in turn, status to vhci_hcd? What does these 0-N subdirectories represent? What does 'status' represent? Why would status have subdirectories? status under VHCI should rather be port_status. So hierarcy would be VHCI_HCD-port_status-port_number[0-8]-attributes Why put the port number below the status? And why in that subdirectory would you have another file called status? Status is the status of the port if its connected to the stub on the server. If this is not good, what would be the best layout? HCD-port[N]-attributes where you have a bus for your HCD, and then port[N] are devices attached to that bus. Sound reasonable? thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Sysfs Device Attributes: Subdirectory under subdirectory
On Fri, Jan 29, 2010 at 12:12:31AM +0530, Himanshu Chauhan wrote: Dear all, I want to create subdirectory under subdirectory in sysfs for a device. Ick, don't. For example, if vhci_hcd is my device I want the following hierarchy: vhci_hcd | +-- status | +---0 || |+-- status || |+-- speed || |+-- device id || |+-- socket || |+-- busid | +---N | +-- status | +-- speed | +-- device id | +-- socket | +-- busid No, you really do not want this. Why do you feel that you would want to create something that does not fit into the current driver/device model of the kernel? In short, what specifically are you trying to convey here? So, how do I create subdirectories 0 to N under status? I created attribute groups from 0 to N, how do I attach it to status and then in turn, status to vhci_hcd? What does these 0-N subdirectories represent? What does 'status' represent? Why would status have subdirectories? And why in that subdirectory would you have another file called status? totally confused, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: automatic driver loading functionality in Linux
On Wed, Jan 27, 2010 at 10:58:59AM +0530, Joel Fernandes wrote: Hi Greg. What you want to look at is the modules.alias file. ?That is what makes things so simple, it creates a mapping from a device/product id to the actual module. I get the idea now, thanks. So when a device is connected, a modalias is generated with the vendor/productid and then modprobe can match this against the modalias file to load the module in. Exactly. Does udev do the same thing when it has to autoload a module? udev just passes this modalias on to modprobe directly, this is how modprobe sees the alias in the first place. modprobe is not called directly by anything else. hope this helps, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: sysfs_ops show vector: size of buffer not required?
On Tue, Jan 26, 2010 at 12:01:27PM +0530, Himanshu Chauhan wrote: On Mon, Jan 25, 2010 at 08:36:46PM -0800, Greg KH wrote: On Sun, Jan 24, 2010 at 01:11:18PM +0530, Himanshu Chauhan wrote: Hi All, The sysfs_ops's show vector doesn't have a size of the buffer given to the vector, while store on the other hand has. What is the rationale behind it? If you need to check the size, you are doing something wrong. Seriously, that is the reason. A sysfs file should be a single value, which will never overflow the buffer. I was talking in context of usb/ip's show_status. It writes a lot of data into this buffer. Then it needs to be fixed. Again, it must be, one value per file, that is the sysfs rule. Which seems to over flow the buffer. But anyways, I will check if it can be reduced or at least be splitted into differnt device attributes. That would be great. BTW, Greg, Did you take a look at other patches I had sent? Are are worth or I need rework? They are in my to-apply queue that I will be flushing out in the next few days. thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: automatic driver loading functionality in Linux
On Sun, Jan 24, 2010 at 10:49:24AM +0530, Joel Fernandes wrote: Hi Peter, Thanks for your message. Actually I'm interested in how modprobe autoloads modules based on the modalias files in sysfs. I read this in Greg KH's great book - Linux Kernel in a Nutshell and I've been wondering how the modules would get loaded if they had to be loaded in the first place to have the device-module list to exist. modprobe is smart and knows what modules support what devices based on the cache it creates when you run 'depmod' when a new kernel is installed. That information is found in the drivers themselves. See the modprobe code for details if you wish to know the exact mechanisms involved, it's pretty easy code to understand. hope this helps, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Small patches for Linux kernel
On Tue, Jan 26, 2010 at 12:41:46PM +0530, Himanshu Chauhan wrote: Hi All, Where should I send small patches? Patches which address small compilation warnings etc. Linux kernel mailing list receives a lot of heavy weight patches and small patches get lost. Which is the best place to send, then? Is Kernel Janitor mailing list alive? Use 'scripts/getmaintainer.pl' to determine this, that is what it is there for. hope this helps, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: detecting usb host controller type/speed from a gadget driver
On Sat, Jan 23, 2010 at 12:42:32PM +0530, Arun S wrote: Hi, From a usb gadget driver, is it possible to detect whether or not a usb 1.1/2.0 HOST CONTROLLER? is managing the usb device during runtime? I want to use different endpoint descriptors based on this info during the setting up of interfaces. The USB spec does not allow this, sorry. Please read the documentation at usb.org for more details. greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: automatic driver loading functionality in Linux
On Tue, Jan 26, 2010 at 11:17:27PM +0530, Joel Fernandes wrote: modprobe is smart and knows what modules support what devices based on the cache it creates when you run 'depmod' when a new kernel is installed. That information is found in the drivers themselves. See the modprobe code for details if you wish to know the exact mechanisms involved, it's pretty easy code to understand. Hi Greg, Thanks a lot :) I just went through the depmod code and it seems that the tables are stored in the 'modinfo' section of the ELF object, and depmod extracts this and dumps it to a map file. And then udev would do a match with this map file whenever a new device is detected and load the required module using modprobe. Do you think my analysis is correct? Close, I don't think the map files are used anymore, and are only around for backward compatibility. What you want to look at is the modules.alias file. That is what makes things so simple, it creates a mapping from a device/product id to the actual module. So then you can do something as simple as: modprobe contents of uevent MODALIAS env variable and modprobe will look at the alias file, and match things up. For example, when I plug a usb flash device in, I get: MODALIAS=usb:v154Bp6545d0200dc00dsc00dp00ic08isc06ip50 so you can do: modprobe usb:v154Bp6545d0200dc00dsc00dp00ic08isc06ip50 looking at the module.alias file, it will match with the usb-storage module, and load that. Or it should, I just tried that out and it didn't quite work out, I'm probably forgetting a step here, but I think you get the general idea. Hope this helps, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: automatic driver loading functionality in Linux
On Tue, Jan 26, 2010 at 08:42:20PM +0200, Ozan T??rky??lmaz wrote: 26.01.2010 17:42, Greg KH yazm: On Sun, Jan 24, 2010 at 10:49:24AM +0530, Joel Fernandes wrote: Hi Peter, Thanks for your message. Actually I'm interested in how modprobe autoloads modules based on the modalias files in sysfs. I read this in Greg KH's great book - Linux Kernel in a Nutshell and I've been wondering how the modules would get loaded if they had to be loaded in the first place to have the device-module list to exist. modprobe is smart and knows what modules support what devices based on the cache it creates when you run 'depmod' when a new kernel is installed. is it possible to get that information (what module determines what driver) from modprobe. Not that I know of, look at the alias file that depmod creates, that holds the information you need. Hope this helps, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: sysfs_ops show vector: size of buffer not required?
On Sun, Jan 24, 2010 at 01:11:18PM +0530, Himanshu Chauhan wrote: Hi All, The sysfs_ops's show vector doesn't have a size of the buffer given to the vector, while store on the other hand has. What is the rationale behind it? If you need to check the size, you are doing something wrong. Seriously, that is the reason. A sysfs file should be a single value, which will never overflow the buffer. I see most of the implementations doing strcpy in the show vectors. Ill behaved driver might overwrite the given buffer when size is not known. Should this be addressed by providing the buffer size along with the buffer pointer? Nope. Again, a single value only, it easily fits into the buffer size. thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: browsing the kernel source with ctags?
On Wed, Jan 20, 2010 at 02:23:04PM -0800, Tony Miller wrote: Yeah you're right... ^_^ I guess ideally, I'd want to find out *which* definition of do_gettimeofday() is being used for the function call I'm looking at. Maybe cscope would help with that. I tried make tags and then tried to look up do_gettimeofday() again, and I got directed to include/linux/time.h, which has the function prototype, which is helpful. It would still be even nicer to see the function body, perhaps another tool could help with that. Use cscope, it knows the difference between prototypes and where the function is defined. good luck, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: browsing the kernel source with ctags?
On Tue, Jan 19, 2010 at 07:13:59PM -0800, Tony Miller wrote: Is it possible to browse the kernel source with ctags? I used exuberant-ctags to generate a tags file for my kernel sources, but it doesn't really work as you expect. If you try to jump to the definition of a function it will often not jump to the right location, for example I tried to jump to the definition of do_gettimeofday() and i ended up in arch/alpha/kernel/time.c. That is the right place for it :) The issue is that you are searching all of the different architectures, how is ctags supposed to know you don't want the alpha definition, but really the ia64 definition of the function? You should try to trim the files you are using, the kernel has a build option for this: make tags or if you use cscope: make cscope Hope this helps, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Kernel Build fail on Ubuntu
On Wed, Jan 20, 2010 at 01:09:30PM +0800, Crossover Lonely wrote: Just use mkinitramfs to create kernel image. For debian/ubuntu system, mkinitramfs works; while for fedora/redhat/slse/opensuse, mkinitrd works. Use 'make install', it will call the correct thing. See the 'make help' documentation for this type of thing. good luck, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Why the linux does not allow the access to a file in the device driver?
On Thu, Jan 14, 2010 at 05:48:21PM -0800, Daniel (Youngwhan) Song wrote: Hi, Could somebody help me to understand the reason why the linux kernel does not allow the access to a file in the device driver? For example, for debugging purpose, if a device driver want to log some data in a file by using open/write/read method like in user application, how a driver can access to a file in a specific filesystem? Any comment or docs or web pages would be appreciated. Please read the documentation at kernelnewbies.org for why this is so. good luck, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Clear screen from the kernel
On Wed, Jan 13, 2010 at 07:05:32PM -0300, Diego Woitasen wrote: Hi, I want to clear the console before a printk() call. Is there a funcion in the kernel API to do it? No, printk() goes to the kernel log, not the screen. Yes, it might also be copied to the console at different times, but it is not a generic thing. good luck, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: anyone use sparse for static code analysis?
On Tue, Jan 05, 2010 at 11:06:40AM -0500, Robert P. J. Day wrote: just curious ... i've never taken a close at sparse. is anyone using it for code analysis outside of the linux kernel? Yes. -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: question about __v annotation
On Mon, Jan 04, 2010 at 03:32:07PM -0800, Bruce Blinn wrote: -Original Message- From: kernelnewbies-bou...@nl.linux.org [mailto:kernelnewbies-bou...@nl.linux.org] On Behalf Of Greg KH Sent: Sunday, January 03, 2010 1:27 PM To: Shawn Cc: kernelnewbies@nl.linux.org Subject: Re: question about __v annotation On Sat, Jan 02, 2010 at 09:10:08PM +0800, Shawn wrote: hello guys, I got a newbie confused when I was looking into the source code of s3c2440's RTC driver.I dont know what is __v excatly means.anyone can tell?thanks anyway! #define readb(c) ({ __u8 __v = __raw_readb(__mem_pci(c)); __v; }) __v is an variable that the macro creates and then returns the value of. Don't code like this, it's horrible :) Could you be more specific with what you find wrong with this. The reason I ask is there is code like this all over the kernel. Like what specifically? Wrapping up a function call in a macro just because someone doesn't want to type the whole thing out? That's the horrible thing. Returning a temporary variable isn't a big deal, but an inline function is better to use as you will get the proper type safety. thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: question about __v annotation
On Tue, Jan 05, 2010 at 12:42:03PM +0100, Bernd Petrovitsch wrote: So which is better (in the kernel and for this functions, macros or whatever they really maybe!)? a) #define readb(c) ((__u8)__raw_readb(__mem_pci(c))) which is more a rephrase of the above b) static inline __u8 readb(const void *c) { return __raw_readb(__mem_pci(c)); } Caveat emptor: Not compile-tested. Neither is best, use the proper __iomem marking for the memory space, and use the built-in kernel functions to read and write data to io space, they are there for a reason, don't try to roll your own. thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: question about __v annotation
On Tue, Jan 05, 2010 at 11:00:37PM +0800, Pei Lin wrote: i only can think about the reason why not use the inline is that it is support by C99 but not support by C89 ANSI C. No, the Linux kernel supports inline functions, no one builds the kernel with a C89-only complier, thankfully. thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: question about __v annotation
On Sat, Jan 02, 2010 at 09:10:08PM +0800, Shawn wrote: hello guys, I got a newbie confused when I was looking into the source code of s3c2440's RTC driver.I dont know what is __v excatly means.anyone can tell?thanks anyway! #define readb(c) ({ __u8 __v = __raw_readb(__mem_pci(c)); __v; }) __v is an variable that the macro creates and then returns the value of. Don't code like this, it's horrible :) thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Probe method vs attach method.
On Tue, Dec 15, 2009 at 12:04:33PM -0600, LKomz Komz wrote: Thanks Pei and Greg. I got it to compile without errors and working by moving to the new method. One issue though is:- Would it be possible to run a usermode driver to access an i2c device when I am not exercising the kernel mode driver (i.e without rmmode - ing the driver)? (Basically it boils down to can drivers of two nature - i.e kernel mode and user mode , access the same part one after the other without any problem?) Without any problem, maybe, but you are taking big chances on doing that, as they both don't know about the other. It is generally preferred to only have one controller of the hardware, be it in the kernel, or in userspace. So please pick just one. good luck, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Problems while adding sysfs support to older device driver
On Mon, Dec 14, 2009 at 11:34:09AM +0100, Bjoern Hinrichs wrote: Reading my mail again I see that I was unclear about what I was trying to do, sorry. I want a device node (e.g. /dev/titan) to be generated automatically for my device. I was expecting udev to do so using a default name, but it is not. Because of that I started comparing uevents with other drivers and saw that they are seeing additional uevents, therefore I thought that that my mistake was there. Ah, to do that you need to pass a device major:minor to the function you used to create your struct device in the kernel. But usually that is done already by the class-specific code that your device uses to talk to the rest of the kernel (input, misc, network, etc.) What type of device is this? And have you properly hooked it up to the class for it? If it is its own class, then you need to create your own device to have it show up properly. Use device_create() to do this. Hope this helps, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: How to send SCSI command from kernel thread.
On Mon, Dec 14, 2009 at 05:34:05PM +0530, hari krishnan wrote: Hi All, I need to send SCSI command asynchronously(Don't want to block my thread) and it should be non-GPL API. That's rather rude of you to assume that you can override the kernel license by your own one. If you don't want to use Linux, you don't have to, but please, if you do use Linux, abide by the license of it. To do otherwise is to somehow claim that your tiny needs are more important than the many thousands of other developers. thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: kbuild - two obj's from one source
On Fri, Dec 11, 2009 at 01:33:08PM +1300, Michal Ludvig wrote: On 12/10/2009 06:11 PM, Greg KH wrote: On Thu, Dec 10, 2009 at 01:45:30PM +1300, Michal Ludvig wrote: Hi, is it somehow possible to generate two separate kernel modules from one source file? What I want is roughly: mymodule-type1.ko compiled from: mymodule.c -D_TYPE_1 and mymodule-type2.ko compiled from: mymodule.c -D_TYPE_2 [..] You can't do it directly. You can do it by a trick of having the .c file included from another .c file. But I really don't recommend doing it, please figure out how to handle both code types together in the same module, as the same time, that's the only way the code would be acceptable to the kernel community. Thanks Greg. I have factored the type1/type2 backends out to two separate source files and link the two kernel modules from a common frontend and one of the backends. The Makefile now looks much cleaner too. See, the limitations of the build service are there for a reason, it forces you to write cleaner code :) Glad it's now working, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Probe method vs attach method.
On Wed, Dec 09, 2009 at 10:40:05AM -0600, LKomz Komz wrote: Are there any documentation on what the changes in the i2c modules are going from 2.6.22 to 2.6.31. Yes, you have the exact number of specific changes that have happened between those two kernel versions, in the kernel source code itself. Please use that to determine what has changed, no other type of documentation would be as complete :) Also note, that between those two versions, a few hundred thousand kernel changes have happened, which is not insubstancial. Good luck, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: kbuild - two obj's from one source
On Thu, Dec 10, 2009 at 01:45:30PM +1300, Michal Ludvig wrote: Hi, is it somehow possible to generate two separate kernel modules from one source file? What I want is roughly: mymodule-type1.ko compiled from: mymodule.c -D_TYPE_1 and mymodule-type2.ko compiled from: mymodule.c -D_TYPE_2 obj-m += mymodule-type1.o obj-m += mymodule-type2.o CFLAGS_mymodule-type1.o = -D_TYPE_1 CFLAGS_mymodule-type2.o = -D_TYPE_2 and mymodule.c symlinked to mymodule-type1.c and mymodule-type2.c Now I'd like to get rid of the symlinks. I've gone through the kbuild docs but can't find how to do that. Any ideas? You can't do it directly. You can do it by a trick of having the .c file included from another .c file. But I really don't recommend doing it, please figure out how to handle both code types together in the same module, as the same time, that's the only way the code would be acceptable to the kernel community. good luck, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Problems while adding sysfs support to older device driver
On Mon, Dec 07, 2009 at 10:54:36AM +0100, Bjoern Hinrichs wrote: Hi, I'm running into some walls here while trying to add sysfs support to an older device driver for a PCI framegrabber device. I started by adding a --- static struct pci_driver titan_driver = { .name = DRV_NAME, .id_table = titan_pci_tbl, .probe = titan_probe, .remove = titan_remove, }; --- and calls to pci_register_driver / pci_unregister_driver. As expected the driver shows up under /sys/bus/pci/drivers and claims the right device: --- $ ls -la /sys/bus/pci/drivers/titan/ total 0 drwxr-xr-x 2 root root0 2009-11-30 09:14 . drwxr-xr-x 13 root root0 2009-11-30 09:14 .. lrwxrwxrwx 1 root root0 2009-11-30 09:14 :00:0b.0 - ../../../../devices/pci:00/:00:0b.0 --w--- 1 root root 4096 2009-11-30 09:14 bind lrwxrwxrwx 1 root root0 2009-11-30 09:14 module - ../../../../module/titan --w--- 1 root root 4096 2009-11-30 09:14 new_id --w--- 1 root root 4096 2009-11-30 09:14 remove_id --w--- 1 root root 4096 2009-11-30 09:14 uevent --w--- 1 root root 4096 2009-11-30 09:14 unbind --- Now I want device files to be automatically generated, but it seems as if I'm missing someting here. udevadm tells me I'm getting the following uevents: --- KERNEL[1259568653.205951] add /module/titan (module) UDEV_LOG=3 ACTION=add DEVPATH=/module/titan SUBSYSTEM=module SEQNUM=682 KERNEL[1259568653.206472] add /bus/pci/drivers/titan (drivers) UDEV_LOG=3 ACTION=add DEVPATH=/bus/pci/drivers/titan SUBSYSTEM=drivers SEQNUM=683 UDEV [1259568653.215901] add /module/titan (module) UDEV_LOG=3 ACTION=add DEVPATH=/module/titan SUBSYSTEM=module SEQNUM=682 UDEV [1259568653.236102] add /bus/pci/drivers/titan (drivers) UDEV_LOG=3 ACTION=add DEVPATH=/bus/pci/drivers/titan SUBSYSTEM=drivers SEQNUM=683 KERNEL[1259568653.205951] add /module/titan (module) UDEV_LOG=3 ACTION=add DEVPATH=/module/titan SUBSYSTEM=module SEQNUM=682 --- This looks to me as if I'm missing some uevents here. I guess there's something I should be doing in .probe, but I'm neither sure whether that's correct nor what it is. (Of course I can still add device files using mknod, but that'd be kinda .. boring.) Someone willing to give me a hint? That all looks correct, what specifically is wrong here? You don't get a uevent for adding a sysfs file, only when you add a struct device (or kobject) to sysfs. What type of sysfs file are you adding to your driver? What do you want to export to userspace? You do know the rules about sysfs files, right? thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: keyboard
On Sat, Dec 05, 2009 at 04:57:59PM -0500, Herlin R. Matos Lastres wrote: Hi, I need manage the keyboard, for example read the data comming from keyboard. Which keyboard? Lots of them can be plugged in at once and they can be of different types (bluetooth, usb, virtual, serial, ps/2, etc.) And read it from where, within the kernel or from userspace? And finally, why do you need to do this? What is the problem you are trying to solve? thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Probe method vs attach method.
On Fri, Dec 04, 2009 at 02:29:36PM -0600, LKomz Komz wrote: Thanks Greg for the reply! I have an i2c driver written using the attach method for binding. It opens the device and reads the registers etc. The following document talks about another binding method. http://www.kernel.org/doc/Documentation/i2c/upgrading-clients Could you clarify that whether the new binding method is the way to go for i2c devices. Yes, why would the document lie? Do I have to rewrite the current driver to make it compatible with future kernel versions.? Yes. The best thing for you to do is get it into the main kernel tree, then it will remain compatible with future kernel versions as the API changes over time. thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Probe method vs attach method.
On Wed, Dec 02, 2009 at 03:51:19PM -0600, LKomz Komz wrote: Hello all, Could you help me understand the latest trends in Kernel mode drivers. I hear that there are two methods by which the driver attaches itself to the kernel: 1)Probe method and 2)Attach method. I have a driver written using the attach method. Is the kernel driver community moving towards probe method? It depends on the type of driver you are writing. What type of driver are you thinking of? And do you have an example of what you think the differences are? As the maintainer of the kernel's driver core, I really don't understand what you are getting at, and I think I should :) thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Up to date driver-model docs?
On Sat, Nov 28, 2009 at 12:04:44AM +, Philip Downer wrote: Is there any up to date documentation of the driver-model? I've found that device.h is different to the docs in Documentation/driver-model/driver.txt and was going to post here when I found the following thread[1] from 2004. It's referring to different files to driver.txt but I'm assuming that everything is out of date as unfortunately nothing seems to have come from the old thread and I can't find any correct documentation. Have you looked at the kerneldoc for the driver core? My immediate issue is that as per the docs, I wanted to use the supposed list structure in struct device_driver to get a list of all the devices attached to the driver, so if anyone can help me with that then I'd be grateful. Why would you need this? What problem are you trying to solve? thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: DMA issue with USB devices
On Mon, Nov 23, 2009 at 02:35:02PM -0600, Asim wrote: Thank you for the response. I was referring to security issues due to an incorrect DMA from a bad/malicious device. If you have such a device, it can do bad things :) I guess I will now be looking at whether devices come with their own controller and how abundant they are. USB devices? They do not. good luck, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: DMA issue with USB devices
On Wed, Nov 18, 2009 at 04:07:56PM -0600, Asim wrote: Hi, I realize there is an issue with PCI devices due to the possibilities of a bad DMA due to a bad driver/device. What specific issue are you referring to? Does this problem manifest to USB drivers as well or does the usb core ensure that the DMA addresses are always mapped correctly? Can anyone point me to the code file where this is being done. USB host controllers are PCI devices on most systems, so the issue should be the same, right? On their own, USB drivers do not do DMA. thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: MTP Class driver
A: No. Q: Should I include quotations after my reply? http://daringfireball.net/2007/07/on_top On Wed, Nov 11, 2009 at 05:43:36PM +0530, Satheesh Kumar wrote: may be i am not clear with my doubts.. 1. i am writing a new USB class driver for MTP devices. But when i plug-in the device it is atomatically recognised with mass storage module taking the interface information. But the string descriptor defined as MTP, so how i can lead my class driver to probe the device before usb_stroage module picks. You can't, what you need to do is modify the usb_storage module to not bind to these types of devices, and then your driver will always be properly loaded. Do you have a pointer to the source for your driver code somewhere? 2. How USB plugin event in class driver can be passed to userspace. So that my MTp library application can understand asynchronoously that device been pluged in. Example if i connect iPod in Linux system it gets recognised by rhytom box application immediately. How come rythmbox able to know that a media player device pluged in. It listens to HAL or libudev events, depending on the version of the distro (HAL is being removed from the system right now, so don't write new code depending on it please.) Nothing new needs to be done in your driver at all, the kernel infrastructure and udev do this kind of notification for you automatically. Hope this helps, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: MTP Class driver
On Wed, Nov 04, 2009 at 03:49:15PM +0530, Satheesh Kumar wrote: Hello, I am writing MTP class driver for Cowon Mp3 player. The device has MTP as well as mass storage class support. Although i registered MTP class driver with relevant vendor id and product id, the same info is also available with Mass storage class(MSD) driver, hence on plug-in, by default device detected as MSD class, not as MTP class. How do i override MSD class registration with my MTP class driver ? You send a patch to the linux-...@vger.kernel.org mailing list that adds the ability to not match a MTP device such as your own. Do you have a pointer to your driver anywhere? thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Communication device interrupts to user space via real time signals
On Tue, Nov 03, 2009 at 05:14:50PM +0200, Jason Nymble wrote: On 03 Nov 2009, at 4:47 PM, Greg KH wrote: We have laser welding robots using the UIO code just fine. Same goes for robots cutting wood at 3 meters a second, so I think the latency of UIO is not an issue :) Now you've gone and piqued my curiosity :) Are there any publicly available links or papers or anything to the above-mentioned projects? They were displayed at an industrial conference in Hannover last year, you might try poking around on the OSADL web page for more information. Hope this helps, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Communication device interrupts to user space via real time signals
On Tue, Nov 03, 2009 at 06:13:37PM +0530, wrote: Hi List I am having doubt whether UIO supports asynchronous notification or not. The Documentaionhttp://www.kernel.org/doc/htmldocs/uio-howto.html#wait_for_interruptssays u have to block on read system call to get the event. I think the interrupt implementation in user space needs asynchronous events. right? In case of RT signals, I am not sure whether the latency will be bearable or not. And by default queuing capacity of RT signals is 1024. You may have to override that, in ur case, depending upon ur hardware. We have laser welding robots using the UIO code just fine. Same goes for robots cutting wood at 3 meters a second, so I think the latency of UIO is not an issue :) good luck, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Communication device interrupts to user space via real time signals
On Sat, Oct 31, 2009 at 01:24:48PM +0530, Devesh Sharma wrote: Hello Greg, Thanks for your reply, currently our development is using some older 2.6 version, where I think the support for UIO is not present. Therefore, I am looking this as an alternative solution. Then backport the UIO core to your kernel and write a UIO driver. That way your driver can be accepted into the main kernel tree and you will not end up writing code that will be obsolete from the very beginning :) good luck, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Communication device interrupts to user space via real time signals
On Fri, Oct 30, 2009 at 02:37:36PM +0530, Devesh Sharma wrote: Hello list, I have a physical device for which I am implementing a kernel bypass library in user space, I want to handle certain device specific interrupts from the user space with reliability (Any interrupts is not dropped or missed). How efficient and reliable is the Linux Real Time Signal handling framework for this purpose? Use the UIO kernel interface for this, that's the best way to handle it. good luck, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Mobile OS
On Tue, Oct 13, 2009 at 08:09:50PM +0200, Michael Blizek wrote: Legally, you can call it open source. But what I am saying is that it is not open source in the way people expect it: Um, there is no difference, sorry. - Devices are crippled locked down so. That is a manufacturer decision, not a limitation of the software itself. I have a device that is not locked down, as do thousands of others. - Large parts are not GPL/copyleft, but Apache license. The goal is most likely to empower proprierary vendors to do what they like. Apache license is open source, sorry if you don't like that. - It is lead mostly by a single company and some who followed, not by a community. That has nothing to do with open source or not. - Lots of applications are proprierary. You cannot run the usual Linux applications, as long as they are not completely rewritten. That has nothing to do with the core and infrastructure being open or not. You can freely write closed source applications on Linux, and lots of people do (Oracle, SAP, etc.) The fact that you feel a normal Linux application can not run, again, has nothing to do with calling the system not open source. - There is a real comminity effort called openmoko. openmoko is great, but it has nothing to do with Android and its license. availableunless u run commercial applications like Oracle on it??? nothing to say then :-).. No, but does having a BSD kernel make Apple's OS X open source? No one makes that mistake. Android is open, sorry if you don't like that. Now I do have lots of complaints about how Android is turning out, but again, the license has nothing to do with that, I am very happy to see a totally different userspace running on top of a Linux kernel. It shows how flexable the Linux kernel can be and makes you think twice about what you want to call a Linux system :) thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: linux developer conference reg.
On Fri, Oct 02, 2009 at 01:30:27PM -0400, Anand Arumugam wrote: hi all, has anyone attended any newbie linux developer conference? esp is there anything like that for kernel newbies? a conference where seasoned programmers who want to contribute to linux can learn something and get started with their work? can you please pass on such information? thanks a lot. The Linux Plumbers Conference or linux.conf.au are both very good, technical conferences where new kernel developers can learn a lot. Heck, I learn a lot at both of these conferences, so they are by no means only limited to newbies :) good luck, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: facing a problem with irq handler,please help me
A: No. Q: Should I include quotations after my reply? http://daringfireball.net/2007/07/on_top On Fri, Oct 02, 2009 at 01:00:36PM +0530, Harinderjit Singh Sandhu wrote: i want to know which statement is turning it off. The problem is that you are _not_ turning it off, and you need to. Add that logic to the interrupt handler and you should be fine. As for _how_ to turn it off, well, that's a hardware specific thing that you need to know in order to write the interrupt handler. hope this helps, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: facing a problem with request _irq qnd enable_irq
On Thu, Oct 01, 2009 at 11:54:55AM +0530, Harinderjit Singh Sandhu wrote: --- int ret; printk(initializing module\n); //free_irq(7,NULL); i = register_chrdev (SKELETON_MAJOR, SKELETON_NAME, skeleton_fops); if (i != 0) return - EIO; //disable_irq(7); ret = request_irq (7, interrupt_handler,0,SKELETON_NAME ,NULL); printk(ret=%d\n,ret); //enable_irq(7); if(ret=0){ enable_irq(7); //outb_p(0x10, BASEPORT + 2); } else { printk(Not Working \n); } //printk(Generating interrupt \n); outb(0, BASEPORT); outb(255, BASEPORT); outb(0, BASEPORT); printk(Interrupt generated. You should see the handler-message\n); - when i insmod the module of which this is apart. i get the following output [ 1291.259646] initializing module [ 1291.259672] ret=0 [ 1291.259679] [ cut here ] [ 1291.259682] WARNING: at /build/buildd/linux-2.6.28/kernel/irq/manage.c:225 __enable_irq+0x30/0x70() [ 1291.259685] Unbalanced enable for IRQ 7 [ 1291.259687] Modules linked in: skeleton(+) hid_bright usbhid rfkill_input i915 drm binfmt_misc ppdev bridge stp bnep lp parport arc4 ecb snd_hda_intel snd_pcm_oss snd_mixer_oss snd_pcm pcmcia snd_seq_dummy b43 snd_seq_oss snd_seq_midi snd_rawmidi mac80211 snd_seq_midi_event cfg80211 iTCO_wdt iTCO_vendor_support snd_seq snd_timer snd_seq_device yenta_socket rsrc_nonstatic ricoh_mmc sdhci_pci sdhci snd pcmcia_core led_class intel_agp agpgart soundcore snd_page_alloc pcspkr input_polldev serio_raw uvcvideo compat_ioctl32 videodev v4l1_compat video output ohci1394 ieee1394 8139too 8139cp mii ssb fbcon tileblit font bitblit softcursor [ 1291.259751] Pid: 4400, comm: insmod Not tainted 2.6.28-11-generic #42-Ubuntu [ 1291.259754] Call Trace: [ 1291.259760] [c0139ab0] warn_slowpath+0x60/0x80 [ 1291.259765] [c0181449] ? register_handler_proc+0x119/0x130 [ 1291.259773] [c02cc3b8] ? vsnprintf+0x378/0x5c0 [ 1291.259778] [c013a2f9] ? release_console_sem+0x1c9/0x200 [ 1291.259782] [c017f570] __enable_irq+0x30/0x70 [ 1291.259786] [c017f5ec] enable_irq+0x3c/0x60 [ 1291.259790] [f7f9c000] ? skeleton_init_module+0x0/0x96 [skeleton] [ 1291.259795] [f7f9c078] skeleton_init_module+0x78/0x96 [skeleton] [ 1291.259802] [c010111e] _stext+0x2e/0x170 [ 1291.259807] [c020c015] ? sysfs_addrm_finish+0x15/0xf0 [ 1291.259811] [c020b7e3] ? sysfs_add_one+0x13/0x50 [ 1291.259814] [c020b85f] ? sysfs_addrm_start+0x3f/0xa0 [ 1291.259820] [c01a908c] ? __vunmap+0x9c/0xe0 [ 1291.259823] [c01a908c] ? __vunmap+0x9c/0xe0 [ 1291.259832] [c01a9121] ? vfree+0x21/0x30 [ 1291.259837] [c0163f3a] ? load_module+0x103a/0x1040 [ 1291.259848] [c0163fc8] sys_init_module+0x88/0x1b0 [ 1291.259853] [c01bb5da] ? sys_close+0x7a/0xc0 [ 1291.259857] [c0103f6b] sysenter_do_call+0x12/0x2f [ 1291.259865] [c050] ? relay_hotcpu_callback+0x6d/0xbd [ 1291.259868] ---[ end trace cddcbfa519faa2fe ]--- [ 1291.259870] Interrupt generated. You should see the handler-message and the message in the handler doesnt appear. i am unable to get what is the problem and how can this be solved. please help me out Your irq handler is not working properly, please post the code for that. Also, please follow the kernel coding style rules if you wish to have other people review your code, otherwise it is very difficult for us to do so. good luck, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: facing a problem with irq handler,please help me
On Thu, Oct 01, 2009 at 08:55:27PM +0530, Harinderjit Singh Sandhu wrote: this is the code for the small module that i wrote The problem is in your interrupt handler: // interrupt handler irqreturn_t interrupt_handler (int irqn, void *dev) { printk(Press a key ); return IRQ_HANDLED; } You aren't really handling the interrupt by turning it off in the hardware. So the kernel sees an interrupt storm for your device and shuts it off to save the system from going crazy. What are you trying to do with this sample module? greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: facing a problem with irq handler,please help me
On Thu, Oct 01, 2009 at 09:11:30PM +0530, Harinderjit Singh Sandhu wrote: i was trying to figure out how the interrupts are handled . can you suggest me a reading to have proper knowledge of this ,so that i don't trouble people with such problems Look at a driver with a real interrupt handler? It's not like we don't have a few thousand examples in the kernel already :) good luck, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Paid Kernel Development
On Thu, Sep 24, 2009 at 02:36:56PM +0530, debian developer wrote: Hi Greg, I've submitted quite a few trivial kernel patches previously. I liked your idea of free device driver development too. Good luck to you with that. I want to ask you if there is any place or forum which co-ordinates corporates to sponsor work on Linux kernel development. For example, I work as a software developer and would love to work on Linux full-time. But, It is not really easy for me to do it without some financial support. Whom do I approach in this situation? Where do I ask for financial support to work on Linux? There are lots of jobs offered for Linux kernel developers, why not apply for one of them? It is great that people are ready to work for free, but if some company which has requested a free device driver wants to hire someone, how do we know of it? I do not know of a centralized location for this type of thing, sorry. greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: PCI Issues
On Sun, Sep 13, 2009 at 05:12:11PM +0300, Mena Soliko wrote: Hello, 1. Can several drivers can handle the same PCI device? Officially, No. Unofficially, there are ways to do this, but you have to be _very_ careful. What type of PCI device do you want to control? Is there already a driver bound to it? 2. How can I know which driver currently handles my PCI devices? (lsmod show few drivers that can show a few candidate but I want to know the actual driver that register to that PCI). lspci -k thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: DEVFS permissions
On Mon, Sep 14, 2009 at 08:38:48AM -0400, Shankar Ganesh wrote: Hi , When we create a node under devfs , There is no such thing as devfs anymore. hwcdev_class = class_create(THIS_MODULE, DRVNAME); device_create(hwcdev_class, NULL, MKDEV(dev_major, 0), dev, DEVNAME); the node is created with default permission of 600 (root=rw, others nil) , crw root root252 , How do i make permission setting automatically while creating node ? (i need 666 and don't want to execute chmod 666 /dev/mydev ) Create a udev rule to provide the proper permission for this device. thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: PCI Issues
On Tue, Sep 15, 2009 at 09:19:52AM +0800, Pei Lin wrote: 2009/9/15 Greg KH g...@kroah.com: On Sun, Sep 13, 2009 at 05:12:11PM +0300, Mena Soliko wrote: Hello, 1. Can several drivers can handle the same PCI device? Officially, No. Unofficially, there are ways to do this, but you have to be _very_ careful. What type of PCI device do you want to control? Is there already a driver bound to it? 2. How can I know which driver currently handles my PCI devices? (lsmod show few drivers that can show a few candidate but I want to know the actual driver that register to that PCI). lspci -k hi, grep, The name is Greg :) what is your lspci's version? and in my fc8 ,lspci version is 2.2.6 which has no parameter about -k. fc8 is very old, please use a newer version. I'm running 3.1.4 here. So lspci just can tell me a not very clear info about pci device if there is no device driver attach it. Not true, use a newer lspci version. Or just use the proper symlink in sysfs, it will tell you if a driver is bound to a device, which is what lspci uses. good luck, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Why there is no realloc in kernel?
On Wed, Sep 09, 2009 at 05:13:56PM +0530, Leonidas . wrote: Why there is no realloc in kernel? I see it there, don't you? Any specific reason? Nope, because it is there... thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Why there is no realloc in kernel?
On Sat, Sep 12, 2009 at 04:24:25AM +0530, vinit dhatrak wrote: Hi Greg, Can you point us to it in lxr or something? Look for krealloc(). -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: USB Doubt
On Sat, Sep 05, 2009 at 11:54:45PM +0530, Niamathullah sharief wrote: Hi friends, I want to know about USB devices. I mean,From where the device is searching for driver when we insert the device into USB port? Please read the USB chapter in the book, Linux Device Drivers, Third Edition, free online. It describes all of this. good luck, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: tiny tty driver in ldd3
On Thu, Aug 13, 2009 at 12:57:49PM -0700, srinivasramana wrote: Hi All, 1. I am using the tiny tty driver written by Greg long back. Looks like its too old and hence some compilation issues. Once i resolve that, its giving BUG on add_timer(i tried in 2.6.28 2.6.30). 2. I have two applications one reads and one which calls an ioctl on the same device node. the read app blocks once i start. In the ioctl from second app, i am using tty_flip_buffer_push() to write data to tty core so that the first app unblocks. But i am surprised to see that the data is written back to the tty device using write call. can anybody help me on this? How do i have first read app get the data? Can you post the driver that you now have, and the error you are getting? thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: LDD3 examples advice
On Mon, Aug 10, 2009 at 08:38:50AM -0400, Robert P. J. Day wrote: On Sat, 8 Aug 2009, Greg KH wrote: ... LDD3 is one of the top selling Linux books for the publisher. It's a matter of time and figuring out the best way to produce the next volume of the book in a manner that is not going to cause it to go instantly out of date like the previous version did. Just publishing a new version in dead-tree form would not make much sense anymore as the rate of change in the kernel is increasing so fast that it doesn't make any sense. at the risk of saying something idiotic, why *should* LDD4 be out of date almost the instant it hits the shelves? if the underlying kernel code is really changing that quickly to olsolete the book, that strikes me as a *really* bad sign of kernel instability. Sorry, but have you read Documentation/stable_api_nonsense.txt before? If not, please do so, it will answer this question for you. Also note, the rate of change for the kernel has _increased_ dramatically over the past few years, so that anything that is written down goes out of date faster than it used to in the past. That's just a side affect (or is it effect?) of our rapid development model. note: i'm not talking about the obvious *new* features that are being added constantly to the kernel. obviously, that's going to happen. but is it really true that you can't even write a book on *basic* kernel device drivers without seeing it out of date that quickly? i thought the whole point of the kernel API was that it remain relatively stable for *developers*, regardless of what might happen internally. No, not at all, please read the above file for why. anyone should be able to see that a published book on device drivers will probably become *incomplete* fairly quickly. but is that really the same as saying that it's going to become *wrong*? If you consider examples that do not build anymore due to compiler warnings and errors wrong, then yes, that is the case. thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: LDD3 examples advice
On Sun, Aug 09, 2009 at 03:38:16AM +0530, debian developer wrote: On Fri, Aug 7, 2009 at 11:44 PM, Greg KHgre...@suse.de wrote: On Fri, Aug 07, 2009 at 02:07:32PM +0530, Anuz Pratap Singh Tomar wrote: Yeah LDD3 is outdated now, atleast huge amount of code is not usable as is, and for beginner, it may be difficult to figure out. I donno when LDD4 will be out, but if authors could re-write changed stuff, somewhere online, it would be great. We have no current plans to update LDD3 to LDD4, at the moment. We are all swamped with other work, and discussions with the publisher as to a possible change in format kind of stopped due to lack of energy with everyone involved (due to other work responsibilities.) Just wanted to know if this was the effect of open sourcing(kind of) the book. May be the revenues werenot significant enough for the publisher to push for an update? No, not at all, LDD3 is one of the top selling Linux books for the publisher. It's a matter of time and figuring out the best way to produce the next volume of the book in a manner that is not going to cause it to go instantly out of date like the previous version did. Just publishing a new version in dead-tree form would not make much sense anymore as the rate of change in the kernel is increasing so fast that it doesn't make any sense. So we need to figure out how to do it differently. We have a number of ideas how to accomplish this, but it takes some time to work out all of the details. We'll let everyone know when we have something we can announce. thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: LDD3 examples advice
On Fri, Aug 07, 2009 at 02:07:32PM +0530, Anuz Pratap Singh Tomar wrote: Yeah LDD3 is outdated now, atleast huge amount of code is not usable as is, and for beginner, it may be difficult to figure out. I donno when LDD4 will be out, but if authors could re-write changed stuff, somewhere online, it would be great. We have no current plans to update LDD3 to LDD4, at the moment. We are all swamped with other work, and discussions with the publisher as to a possible change in format kind of stopped due to lack of energy with everyone involved (due to other work responsibilities.) sorry, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: LDD3 examples advice
On Fri, Aug 07, 2009 at 11:14:54AM -0700, Greg KH wrote: On Fri, Aug 07, 2009 at 02:07:32PM +0530, Anuz Pratap Singh Tomar wrote: Yeah LDD3 is outdated now, atleast huge amount of code is not usable as is, and for beginner, it may be difficult to figure out. I donno when LDD4 will be out, but if authors could re-write changed stuff, somewhere online, it would be great. We have no current plans to update LDD3 to LDD4, at the moment. Ok, I take this back, we are now back to discussing this, so there are plans, just no dates. sorry for the noise, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: How to configure usb as console
On Tue, Aug 04, 2009 at 05:35:20PM -0700, Bizhan Gholikhamseh (bgholikh) wrote: Hi All, How could I redirect serial output through USB devices so to act as console? Read the serial console documentation and use ttyUSB0 or some other device node for the configuration. Note, kernel oops messages do not show up in usb consoles, because interrupts are needed to get usb messages out. So it has a limited benifit for development. good luck, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: how to list the current HZ value?
On Tue, Aug 04, 2009 at 09:42:41AM +0800, Pei Lin wrote: 2009/8/2 Greg KH g...@kroah.com: On Sat, Aug 01, 2009 at 03:36:21PM -0400, Robert P. J. Day wrote: On Sat, 1 Aug 2009, Greg KH wrote: On Fri, Jul 31, 2009 at 11:23:15AM +0700, Mulyadi Santosa wrote: On Fri, Jul 31, 2009 at 6:52 AM, Karel Zakk...@redhat.com wrote: It seems that user space sees HZ as 100, while in fact my current running kernel is compiled with HZ=300. What do you think about it? Or is there something wrong with my conclusion? The following C program should properly show you the kernel HZ. thanks, greg k-h -- #include unistd.h #include time.h #include stdio.h int main() { struct timespec res; double resolution; printf(UserHZ %ld\n, sysconf(_SC_CLK_TCK)); clock_getres(CLOCK_REALTIME, res); resolution = res.tv_sec + (((double)res.tv_nsec)/1.0e9); printf(SystemHZ %ld\n, (unsigned long)(1/resolution + 0.5)); return 0; } i already knew about sysconf. so i'm going to assume there's no simpler way to get the current HZ (either command line or /proc based). But the point is, from userspace's point of view, the kernel HZ value means NOTHING. See the above program that shows what the resolution that userspace can use is. That is what userspace cares about, and what the kernel provides. Internal HZ values of what the kernel might use for scheduling means _nothing_. but some applications or drivers especially for stream media i think they need this parameter to get a balance for performance. refer to the link: http://lwn.net/Articles/145973/ i think people need it to configure their kernel. Look at the code I provided, it gives you the value you need to care about. So if you do provide it to userspace in a proc file, what then? What is userspace going to do with such a value? It should never depend on it, because it doesn't matter to it. how do we change the kernel HZ parameter except reconfiguration kernel and rebuild kernel? That is the only way. But again, it should not be an issue at all, except for some very special server loads which wants a low HZ value. Do you have a special workload that needs a specific HZ value to achieve its results? thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: how to list the current HZ value?
On Fri, Jul 31, 2009 at 11:23:15AM +0700, Mulyadi Santosa wrote: On Fri, Jul 31, 2009 at 6:52 AM, Karel Zakk...@redhat.com wrote: Linux exports HZ to userspace via AT_CLKTCK auxiliary vector entry, for more details see include/linux/auxvec.h. The vector is area between process's environ[] and argv[]. I guess glibc reads the vector for the sysconf() call. Karel Hi Karel... I checked that using the following command: $ LD_SHOW_AUXV=1 sleep 1 AT_SYSINFO: 0xb7fed414 AT_SYSINFO_EHDR: 0xb7fed000 AT_HWCAP:fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe AT_PAGESZ: 4096 AT_CLKTCK: 100 AT_PHDR: 0x8048034 AT_PHENT:32 AT_PHNUM:8 AT_BASE: 0x0 AT_FLAGS:0x0 AT_ENTRY:0x8048c50 AT_UID: 500 AT_EUID: 500 AT_GID: 500 AT_EGID: 500 AT_SECURE: 0 AT_??? (0x19): 0xbf84ba4b AT_??? (0x1f): 0xbf84cff1 AT_PLATFORM: i686 It seems that user space sees HZ as 100, while in fact my current running kernel is compiled with HZ=300. What do you think about it? Or is there something wrong with my conclusion? The following C program should properly show you the kernel HZ. thanks, greg k-h -- #include unistd.h #include time.h #include stdio.h int main() { struct timespec res; double resolution; printf(UserHZ %ld\n, sysconf(_SC_CLK_TCK)); clock_getres(CLOCK_REALTIME, res); resolution = res.tv_sec + (((double)res.tv_nsec)/1.0e9); printf(SystemHZ %ld\n, (unsigned long)(1/resolution + 0.5)); return 0; } -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: how to list the current HZ value?
On Sat, Aug 01, 2009 at 03:36:21PM -0400, Robert P. J. Day wrote: On Sat, 1 Aug 2009, Greg KH wrote: On Fri, Jul 31, 2009 at 11:23:15AM +0700, Mulyadi Santosa wrote: On Fri, Jul 31, 2009 at 6:52 AM, Karel Zakk...@redhat.com wrote: It seems that user space sees HZ as 100, while in fact my current running kernel is compiled with HZ=300. What do you think about it? Or is there something wrong with my conclusion? The following C program should properly show you the kernel HZ. thanks, greg k-h -- #include unistd.h #include time.h #include stdio.h int main() { struct timespec res; double resolution; printf(UserHZ %ld\n, sysconf(_SC_CLK_TCK)); clock_getres(CLOCK_REALTIME, res); resolution = res.tv_sec + (((double)res.tv_nsec)/1.0e9); printf(SystemHZ %ld\n, (unsigned long)(1/resolution + 0.5)); return 0; } i already knew about sysconf. so i'm going to assume there's no simpler way to get the current HZ (either command line or /proc based). But the point is, from userspace's point of view, the kernel HZ value means NOTHING. See the above program that shows what the resolution that userspace can use is. That is what userspace cares about, and what the kernel provides. Internal HZ values of what the kernel might use for scheduling means _nothing_. So if you do provide it to userspace in a proc file, what then? What is userspace going to do with such a value? It should never depend on it, because it doesn't matter to it. thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Accessing File system directories
On Tue, Jul 28, 2009 at 07:17:11AM -0700, Dan Danillo wrote: Dan Danillo wrote: Dan Danillo wrote: Hello, I'm trying to find out how to browse the file system from the linux kernel. Especially the directory content is interesting to me. Can anyone give me a hint? Are there even some libc like functions to do that ? You might want to read this: http://kernelnewbies.org/FAQ/WhyWritingFilesFromKernelIsBad OK, I don't understand it all, but I get the meaning that I should not access the file system from the kernel. Then I have no idea how to solve my problem. Maybe you can propose something else. Please have a look here: http://groups.google.com/group/comp.os.linux.embedded/browse_thread/thread/169cc7835af4fd7f/784b3081b0d12072 I'm afraid I'm not sure how to go about this either. As I understand it, you want to emulate a USB mass-storage device containing a FAT file system, utilizing the contents of a local file system which may be formatted using a different file system? Yes, that is correct Could you create a daemon that attaches to a usb gadget driver? The daemon in user space would be able to access whichever file system you want? I could try that, but I did not want to touch g_file_storage. Instead I wanted to write my own block device driver which is used by g_file_storage in turn. So the daemon would be connected to my driver then .. I don't know, that sounds complicated. USB storage is one of the most complex devices out there. I would not recommend using it for a beginning project, it's quite messy. Pick something simple like nfs :) good luck, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Integrating kernel module code into kernel source tree.
On Mon, Jul 27, 2009 at 04:19:43PM +0400, Denis Borisevich wrote: 2009/7/27 Belisko Marek marek.beli...@gmail.com: Hi, On Mon, Jul 27, 2009 at 1:13 PM, Denis Borisevichdennis...@gmail.com wrote: Hi! I have driver for PCI serial board, it compiles as a module, loads and works fine. Now it exists as a several files outside the kernel source tree. I want to integrate this code within the kernel source tree: I want it to exist as some files inside the kernel source, I want to be able to select this driver in kernel config and so on. So can any one provide me any instructions to achieve this task (I hope it is not very difficult) or point to any online documents, etc.? Just read: http://lxr.linux.no/linux+v2.6.30/Documentation/SubmittingDrivers or you can post you files (patches) to Greg K-H (g...@kroah.com) and he will put it to staging directory in linux-next tree. Your driver will be after some cleanups and rewiews put to main kernel tree hopefully. Thank you for reply but I think you got me wrong. I don't want to submit my driver to mainline kernel. I just want to integrate it with my local kernel source tree for personal use. Then add a few lines to the specific Kconfig file where your driver lives in the kernel tree, adding the config option for the driver, and a single line to the relevant Makefile adding the driver to the build. For example, if your driver is called foo, you could add this to the Kconfig file: config FOO tristate Foo device support depends on PCI help This driver support the foo device and then in the Makefile add the line: $(CONFIG_FOO) += foo.o Have you tried that? Do you have a pointer to your driver / patch? thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: How to evaluate linux system performance
On Tue, Jul 28, 2009 at 12:13:10AM +0800, loody wrote: hi: 2009/7/27 Greg KH g...@kroah.com: On Mon, Jul 27, 2009 at 10:57:17PM +0800, loody wrote: Dear all: Would someone please tell me what are the key items about linux performance? What ever you care about :) I only write the driver before, kernel for me just like another big API. If I want to know whether my driver will make kernel performance not well, how can I do? Run it and see what happens. Do you have any _specific_ questions about this kind of thing? How about a pointer to the driver you are referring to? I apologze for posting the wrong place. I should post it to the kernle mailing list. :) Everything I finish porting driver, what I do and only I know is check whether file i/o is correct. But I have no idea is there any key word/items/list I should check in the kernel. BTW, is there any test bench or test program I can evaluate kernel performance? appreciate your help, There are lots of test programs that do this. But again, it depends on what you care about. Can you post a link to your driver? thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: sizeof(dev_t)
On Sun, Jul 12, 2009 at 10:16:17PM +0530, SandeepKsinha wrote: Hi, to my surprise, the sizeof dev_t differs in userspace and kernel. Its 8 bytes in userspace and 4bytes in kernel. I am working on a driver, where I include the headers in both user and kernel space. And I get wrong values due to the difference in sizes. How do I handle such a situation ? Why would you be passing a dev_t from user to kernel space as a binary value? Why do you want to pass such a value across the boundry in the first place? Could you describe what the problem is you are trying to sove by doing this? thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Export sys_call_table
On Sun, Jul 12, 2009 at 04:40:00PM +0200, Donato Capitella wrote: Hi there. I'd like to know if there is a way to export the sys_call_table symbol in the kernel 2.6.28.7. No. i know it's a bad thing to do but I need to to this for a didactical purpose. Why do you want to do this? You really do not want to ever touch this table, and if you are trying to overload a syscall, this is not how you do it. Heck, why would you want to overload a syscall anyway? You can't do it in a safe and secure manner, so why not use the proper hooks the kernel provides you to do stuff like this? thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Export sys_call_table
On Sun, Jul 12, 2009 at 08:53:55PM +0200, Donato Capitella wrote: On Sun, 2009-07-12 at 11:16 -0700, Greg KH wrote: On Sun, Jul 12, 2009 at 04:40:00PM +0200, Donato Capitella wrote: Hi there. I'd like to know if there is a way to export the sys_call_table symbol in the kernel 2.6.28.7. No. i know it's a bad thing to do but I need to to this for a didactical purpose. Why do you want to do this? You really do not want to ever touch this table, and if you are trying to overload a syscall, this is not how you do it. Thank you for answering, but there's no need to explain why it is a bad thing; I said I know it's bad for a plathora of reasons. I just asked if there is a way to do that. I am doing an experiment and I need to be able to do that, if it is still possible in some way to do that. You might want to change your experiment if you know this is something that you shouldn't be doing :) good luck, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: How to enable the print timestamping in dmesg
On Sat, Jul 11, 2009 at 09:14:37AM +0530, H M Thalib wrote: Currently I am involved in optimzion the bootime for kenel I would like to know if there is any other tools that can be used or methods used for optimzing the kerenl. Thanks If you are measuring the boot time of the kernel, use the scripts/bootchart.pl script. You get nice .svg outputs like the following one I just generated doing this same kind of work. Hope this helps, greg k-h attachment: kernel-boot-chart-2.6.30.1-3.svg
Re: sysfs entries for the character driver
On Thu, Jul 09, 2009 at 05:18:39PM +0530, arun c wrote: Hi, I want to create sysfs entries for my character device in order to manipulate (show, store) the device parameters. I am registering the character driver by alloc_chrdev_region + cdev_init + cdev_add. what is the preferred method to create sysfs entries for the new character device? Do so on the struct device that your bus type hands to you. The hardware for which I am writing driver is like this Its is a PCI card with 4 or 2 CAN devices(depending on the board varient) on it. /dev/canN will be the dev node for the devices My doubt is whether I have to create sysfs entries in the folder /sys/bus/pci/devices/ or use class_create() + device_create() and then create the entries in the folder /sys/class/my_new_class/? You could, if you wish to create a new class. Odds are you should just use the existing interfaces provided for this. For a PCI device, use the PCI device structure passed to your probe function. thanks, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ