I am writing a simple driver. Here I’m learning ioctl calls, they work perfect in copy_to_user and copy_from_user part but not in get_user and put_user part. It works if I send some data by those functions; problem is when I have to just pass an integer or character value: in above part it works fine fo…
Tag: linux-device-driver
When using PF_PACKET type of socket, what does PACKET_ADD_MEMBERSHIP?
When using a PF_PACKET type of socket with protocol type ETH_P_IP, the man packet documentation talks about a socket option for multicast. The socket option is PACKET_ADD_MEMBERSHIP. Assuming you use PACKET_ADD_MEMBERSHIP socket option on a PF_PACKET socket correctly, what features and benefits and use cases …
ALSA vs PulseAudio – Latency Concerns
Good day, I have been debating some details with a colleague about ALSA vs PulseAudio, and need some help coming to a conclusion with it. It’s to my understanding that ALSA is relatively low-level, and talks directly to the hardware, while PulseAudio sits on top of ALSA as a service. Additionally, it…
What’s the CONFIG_OF in linux?
I see that it is being widely used at many places but could not understand in what scenarios I need to use it. What is CONFIG_OF? What is the full name of “OF”? Answer Open Firmware. This was invented long time ago when Apple was producing laptops based on PowerPC CPUs and Sun Microsystems worksta…
__builtin_return_address returns null for index >0?
I want to get the return address of the caller function. I’m using __builtin_return_address() funtion, but if I give index value greater than 0 it is returning NULL. Please help me with this or tell me any other function to get the same. Answer See this answer to a related question. __builtin_return_add…
Difference between spi_driver.id_table and spi_driver.driver.of_match_table
I’m currently trying to understand how linux drivers work. As far as I know, A driver’s probe/init function is called when the kernel parses the corresponding .compatible string in the device tree. However, in the arizona-spi driver it looks like there are multiple compatible strings referenced in…
difference between device file and device driver
I am currently reading the Linux Module Programming Guide and I have stumbled onto two terms that have confused a bit – device files and device driver. Upon goggling these terms I have come across the following- A device driver is a piece of software that operates or controls a particular type of device…
Where do I store dynamically allocated memory on a platform device (without using globals)?
I want to make the platform driver I’m writing reentrant: where do I store memory dynamically assigned during the probe and/or open calls (int probe(struct platform_device*)/int open(struct inode *inode, struct file *)) The driver can be instantiated on multiple pieces of in-system hardware, with each o…
how to find Linux module path
in the linux, lsmod lists a lot of modules. but how can we find where those module loaded from. for some modules,linux command “modprobe -l” shows a path but some are not. edited i also tried “find” and “locate”. both of them lists all kind of versions Answer You can use &#…
How to pass a value to a builtin Linux kernel module at boot time?
I want to pass a custom parameter to the kernel at boot time, which my new code will use. This parameter is a number. I know how to pass value to kernel module using kernel command line i.e module_param(). Now i want to pass value from u-boot. Is there a way to do this, either during or after boot? Answer