linux-device-driver

Canon DSLR Video loop back using v4l2loopback and EDSDK Liveview?

こ雲淡風輕ζ 提交于 2021-02-19 02:22:28
问题 I want to use my DSLR camera as video input for let say Skype / Google talk under Linux and Android. Is it possible to create a video loop back using v4l2loopback and Canon EDSDK ? how can I pipe the liveview buffer from the camera to the video loop back ? Thanks 回答1: you will need a "producer" application, that writes frames to the loopback device (and which has previously acquired those frames via the canon esdk) v4l2loopback already comes with a few simple producer examples, and you could

How does “get_user_pages” work (For linux driver)

落爺英雄遲暮 提交于 2021-02-18 22:37:28
问题 Working on a Linux PCI driver, now I'm trying to write codes for DMA using scatter/gather. For now, I've learned that to access to DMA datas directly from User space, we need to pin user space pages to kernel space. And to do this, we have get_user_pages , its full definition is like: int get_user_pages(struct task_struct * tsk, struct mm_struct * mm, unsigned long start, int nr_pages, int write, int force, struct page ** pages, struct vm_area_struct ** vmas); My first question is about the

Sending signal from kernel to user space [closed]

十年热恋 提交于 2021-02-18 12:38:27
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 8 years ago . How to get signal from kernel space to user space? 回答1: To get the signal from kernel to user space use the following code in your user space and kernel space code as below : user space application : signal(SIGIO

Where is the heap?

六月ゝ 毕业季﹏ 提交于 2021-02-17 06:20:09
问题 I understand that in Linux the mm_struct describes the memory layout of a process. I also understand that the start_brk and brk mark the start and end of the heap section of a process respectively. Now, this is my problem: I have a process, for which I wrote the source code, that allocates 5.25 GB of heap memory using malloc . However, when I examine the process's mm_sruct using a kernel module I find the value of is equal to 135168. And this is different from what I expected: I expected brk

How socketcan get send failure status?

可紊 提交于 2021-02-11 14:47:00
问题 As we all know, in the CAN bus communication protocol, sender know whether the data was successfully sent. I send socketcan data as follows. ret = write (socket, frame, sizeof (struct can_frame)); However, even if the CAN communication cable is disconnected, the return value of ret is still 16(=sizeof (struct can_frame)).I queried the information and found that the problem was due to the tx_queue of the network stack used by socketcan. When write is called multiple times, the buffer is full

How to extract entire packet from skb including ethernet header, ip, and tcp plus pay load in poll method of device driver

孤街浪徒 提交于 2021-02-11 12:10:03
问题 in r8169 driver from realtek it does rx_buf = page_address(tp->Rx_databuff[entry]); dma_sync_single_for_cpu(d, addr, pkt_size, DMA_FROM_DEVICE); prefetch(rx_buf); skb_copy_to_linear_data(skb, rx_buf, pkt_size);<----//Do I get packet at this???? skb->tail += pkt_size; skb->len = pkt_size; dma_sync_single_for_device(d, addr, pkt_size, DMA_FROM_DEVICE); //csum... skb->protocol = eth_type_trans(skb, dev); napi_gro_receive(&tp->napi, skb); this is inside rtl_rx function called from poll of driver.

How to extract entire packet from skb including ethernet header, ip, and tcp plus pay load in poll method of device driver

耗尽温柔 提交于 2021-02-11 12:05:58
问题 in r8169 driver from realtek it does rx_buf = page_address(tp->Rx_databuff[entry]); dma_sync_single_for_cpu(d, addr, pkt_size, DMA_FROM_DEVICE); prefetch(rx_buf); skb_copy_to_linear_data(skb, rx_buf, pkt_size);<----//Do I get packet at this???? skb->tail += pkt_size; skb->len = pkt_size; dma_sync_single_for_device(d, addr, pkt_size, DMA_FROM_DEVICE); //csum... skb->protocol = eth_type_trans(skb, dev); napi_gro_receive(&tp->napi, skb); this is inside rtl_rx function called from poll of driver.

Reference to “current” task in Linux Interrupt Context

流过昼夜 提交于 2021-02-11 08:15:51
问题 As I was going through the Interrupt Handling in Linux, I had this question if we can make reference to the current macro pointing to the interrupted task, while the core is in hard-irq mode? Also, if this referencing is possible whatwill happen if we make a call to semaphore "down", though this is highly discouraged.? 回答1: I believe it's possible to do, at least on x86, in the sense that it won't cause an immediate panic. It is however ALWAYS wrong to do this. An interrupt is not associated

Reference to “current” task in Linux Interrupt Context

人盡茶涼 提交于 2021-02-11 08:15:43
问题 As I was going through the Interrupt Handling in Linux, I had this question if we can make reference to the current macro pointing to the interrupted task, while the core is in hard-irq mode? Also, if this referencing is possible whatwill happen if we make a call to semaphore "down", though this is highly discouraged.? 回答1: I believe it's possible to do, at least on x86, in the sense that it won't cause an immediate panic. It is however ALWAYS wrong to do this. An interrupt is not associated

pci_rescan_bus() doesn't rescan PCI bus in Linux

岁酱吖の 提交于 2021-02-11 05:59:32
问题 I am trying to rescan PCI bus in my own kernel driver with the help of pci_rescan_bus() kernel function but I do not see it is functioning same. If I try to do same from user space by running following command, I see that rescanning happens: echo 1 > /sys/devices/pci0000:00/0000:00:14.1/rescan I am trying to re-initialize my ethernet ports which sit on PCI bus. Below is the code I am using for now: struct pci_dev *pci_eth_dev01, *pci_eth_dev02 = NULL; pci_eth_dev01 = pci_get_device(0x10ec,