{"id":8939,"date":"2022-04-09T04:00:47","date_gmt":"2022-04-09T04:00:47","guid":{"rendered":"http:\/\/fastbitlab.com\/?p=8939"},"modified":"2023-01-16T16:01:27","modified_gmt":"2023-01-16T10:31:27","slug":"pcd-driver-with-multiple-devices-code-implementation-part-5","status":"publish","type":"post","link":"https:\/\/fastbitlab.com\/blog\/pcd-driver-with-multiple-devices-code-implementation-part-5\/","title":{"rendered":"Linux Device Driver Programming Lecture 53| Pcd driver with multiple devices code implementation part-5"},"content":{"rendered":"<div class=\"boldgrid-section\" style=\"background-image: linear-gradient(to left, #eeeeee, #eeeeee);\" data-bg-color-1=\"#EEEEEE\" data-bg-color-2=\"#EEEEEE\" data-bg-direction=\"to left\">\n<div class=\"container\">\n<div class=\"row\" style=\"padding-top: 35px; padding-bottom: 0px; background-image: linear-gradient(to left, #eeeeee, #eeeeee);\" data-bg-color-1=\"#EEEEEE\" data-bg-color-2=\"#EEEEEE\" data-bg-direction=\"to left\">\n<div class=\"col-md-1 col-sm-12 col-xs-12 col-lg-1\">\n<p>&nbsp;<\/p>\n<\/div>\n<div class=\"col-md-10 col-sm-12 col-xs-12 col-lg-10\">\n<h1 class=\"\" style=\"text-align: center; font-size: 30px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; line-height: 50px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><strong><span style=\"color: #333399;\">Pcd driver with multiple devices code implementation part-5<\/span><\/strong><\/h1>\n<div class=\"row bg-editor-hr-wrap\" style=\"border-width: 0px; margin-top: -25px;\">\n<div class=\"col-lg-12 col-md-12 col-xs-12 col-sm-12\">\n<div>\n<p>&nbsp;<\/p>\n<div class=\"bg-hr bg-hr-10 color2-color\" style=\"border-style: solid; border-width: 0px 0px 3px;\"><\/div>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">In this article, let&#8217;s implement the pcd_open method(Shown in Figure 1).<\/span><\/p>\n<figure id=\"attachment_8942\" aria-describedby=\"caption-attachment-8942\" style=\"width: 924px\" class=\"wp-caption aligncenter\"><img fetchpriority=\"high\" decoding=\"async\" class=\"size-full wp-image-8942\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/04\/Figure-1-5.png\" alt=\"Figure 1. Pcd_open method\" width=\"924\" height=\"447\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-1-5.png 924w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-1-5-300x145.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-1-5-768x372.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-1-5-600x290.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-1-5-120x58.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-1-5-500x242.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-1-5-200x97.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-1-5-400x194.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-1-5-800x387.png 800w\" sizes=\"(max-width: 924px) 100vw, 924px\" \/><figcaption id=\"caption-attachment-8942\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 1. Pcd_open method<\/span><\/figcaption><\/figure>\n<p data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">As you know, the open method of the driver gets called whenever the user space application tries to open our device file. In this open method, the virtual file system actually provides us the inode, a structure address of our device file, and also a pointer to the struct file. I think you already know this fact, that is, for every open attempt, the kernel creates the file kernel object.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">In this open method, the driver must find out on which device file the open was attempted by the userspace because we have got four device files, isn&#8217;t it? You should find out on which device file the operation was attempted.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">This we can easily find out by getting the information from the inode. Because for every device file, there will be one inode.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">If you check the inode structure, here is an inode structure as shown in Figure 2.&nbsp;<\/span><\/p>\n<figure id=\"attachment_8943\" aria-describedby=\"caption-attachment-8943\" style=\"width: 931px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"wp-image-8943 size-full\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/04\/Figure-2-3.png\" alt=\"Pcd driver\" width=\"931\" height=\"422\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-2-3.png 931w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-2-3-300x136.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-2-3-768x348.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-2-3-600x272.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-2-3-120x54.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-2-3-500x227.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-2-3-200x91.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-2-3-400x181.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-2-3-800x363.png 800w\" sizes=\"(max-width: 931px) 100vw, 931px\" \/><figcaption id=\"caption-attachment-8943\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 2. Inode structure<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<figure id=\"attachment_8944\" aria-describedby=\"caption-attachment-8944\" style=\"width: 931px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"size-full wp-image-8944\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/04\/Figure-3-2.png\" alt=\"Figure 3. i_rdev field in the inode structure\" width=\"931\" height=\"436\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-3-2.png 931w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-3-2-300x140.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-3-2-768x360.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-3-2-600x281.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-3-2-120x56.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-3-2-500x234.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-3-2-200x94.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-3-2-400x187.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-3-2-800x375.png 800w\" sizes=\"(max-width: 931px) 100vw, 931px\" \/><figcaption id=\"caption-attachment-8944\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 3. i_rdev field in the inode structure<\/span><\/figcaption><\/figure>\n<p data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">And you already know that there are two important fields, that is i_rdev, as shown in Figure 3.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">This represents the device number. So, by checking this number, we can come to know which device is being accessed.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">That&#8217;s why let\u2019s create one variable here called int minor number, as shown in Figure 4.<\/span><\/p>\n<figure id=\"attachment_8946\" aria-describedby=\"caption-attachment-8946\" style=\"width: 934px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-8946 size-full\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/04\/Figure-4-2.png\" alt=\"Pcd driver\" width=\"934\" height=\"444\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-4-2.png 934w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-4-2-300x143.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-4-2-768x365.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-4-2-600x285.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-4-2-120x57.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-4-2-500x238.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-4-2-200x95.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-4-2-400x190.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-4-2-800x380.png 800w\" sizes=\"(max-width: 934px) 100vw, 934px\" \/><figcaption id=\"caption-attachment-8946\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 4. Code to find out which device file open was attempted by the user space<\/span><\/figcaption><\/figure>\n<p data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">First, the driver has to find out the minor number. The minor number is equal to you can use the MINOR macro inode, just dereference to get this field i_rdev. This macro gives you the minor number. As I explained before, the driver distinguishes between different devices using a minor number. So, this gives the minor number. Let&#8217;s print that information.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">And after that, you can access the device private data structure here. Why accessing the device private data structure is important?<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Because, in your driver, before handling any request from the userspace like read, write, open request. There are two things the driver must do. The first one is it should identify which device is being accessed, and it should be ready with its priority structure. Because the private data structure is a structure where all the device-specific information is kept. Like its buffer, address, size, and other things. That&#8217;s why it is very important driver extract the write device-specific information.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Our device-specific structure is struct&nbsp; pcdev_private_data, isn&#8217;t it? Let&#8217;s create one pointer variable, as shown in Figure 5.<\/span><\/p>\n<figure id=\"attachment_8947\" aria-describedby=\"caption-attachment-8947\" style=\"width: 753px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-8947\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/04\/Figure-5-2.png\" alt=\"Figure 5. Creation of struct pcdev_private_data pointer\" width=\"753\" height=\"366\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-5-2.png 753w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-5-2-300x146.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-5-2-600x292.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-5-2-120x58.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-5-2-500x243.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-5-2-200x97.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-5-2-400x194.png 400w\" sizes=\"(max-width: 753px) 100vw, 753px\" \/><figcaption id=\"caption-attachment-8947\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 5. Creation of struct pcdev_private_data pointer<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Now the question is, how do you access the device private data structure of this current device? For this, again, you can take the help of the inode structure. In the inode structure, you find another field called cdev. i_cdev. Let&#8217;s search for that. This actually holds the address of our per device cdev structure.<\/span><\/p>\n<figure id=\"attachment_8948\" aria-describedby=\"caption-attachment-8948\" style=\"width: 757px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-8948\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/04\/Figure-6-2.png\" alt=\"Figure 6.i_rdev field in the inode structure\" width=\"757\" height=\"350\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-6-2.png 757w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-6-2-300x139.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-6-2-600x277.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-6-2-120x55.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-6-2-500x231.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-6-2-200x92.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-6-2-400x185.png 400w\" sizes=\"(max-width: 757px) 100vw, 757px\" \/><figcaption id=\"caption-attachment-8948\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 6. i_rdev field in the inode structure<\/span><\/figcaption><\/figure>\n<p data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">We can take the help of this pointer to access the device private data.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">If you just take a look into our pcdev_private_data, there is a cdev structure, as shown in Figure 7.<\/span><\/p>\n<figure id=\"attachment_8949\" aria-describedby=\"caption-attachment-8949\" style=\"width: 756px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-8949 size-full\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/04\/Figure-7-2.png\" alt=\"Pcd driver\" width=\"756\" height=\"385\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-7-2.png 756w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-7-2-300x153.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-7-2-600x306.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-7-2-120x61.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-7-2-500x255.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-7-2-200x102.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-7-2-400x204.png 400w\" sizes=\"(max-width: 756px) 100vw, 756px\" \/><figcaption id=\"caption-attachment-8949\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 7. Pcdev_private_data structure<\/span><\/figcaption><\/figure>\n<p data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">So, if I access this pointer(<\/span><b>i_cdev<\/b><span style=\"font-weight: 400;\"> from <\/span><b>struct inode<\/b><span style=\"font-weight: 400;\">), I actually get the address of this member element(member element <\/span><b>struct cdev cdev<\/b><span style=\"font-weight: 400;\"> from <\/span><b>struct pcdev_private_data<\/b><span style=\"font-weight: 400;\">). And by using this (member element <\/span><b>struct cdev cdev)<\/b><span style=\"font-weight: 400;\">, I can extract the container address.&nbsp;<\/span><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">Who is a container of this member( <\/span><b>struct cdev cdev) <\/b><span style=\"font-weight: 400;\">element? This(<\/span><b>struct pcdev_private_data)<\/b><span style=\"font-weight: 400;\">&nbsp; is a container of this(<\/span><b>struct cdev cdev)<\/b><span style=\"font-weight: 400;\"> member element. That&#8217;s why, by using the address of a this(<\/span><b>struct cdev cdev)<\/b><span style=\"font-weight: 400;\"> member element, we are going to extract it&#8217;s container.<\/span><\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">For this, we are going to use something called container_of macro. Let&#8217;s explore the container_of_macro.<\/span><\/p>\n<figure id=\"attachment_8950\" aria-describedby=\"caption-attachment-8950\" style=\"width: 547px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-8950\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/04\/Figure-8-2.png\" alt=\"Figure 8. Container of macro\" width=\"547\" height=\"304\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-8-2.png 547w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-8-2-300x167.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-8-2-120x67.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-8-2-500x278.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-8-2-200x111.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-8-2-400x222.png 400w\" sizes=\"(max-width: 547px) 100vw, 547px\" \/><figcaption id=\"caption-attachment-8950\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 8. Container of macro<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">What&#8217;s a container_of_macro?<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">This container_of_macro is defined in \/include\/linux\/kernel.h. This is used to cast a member of a structure out to the containing structure.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">Let me explain what&#8217;s the use of this container_of. So, We have a separate article to explain how this&nbsp;<\/span><span style=\"font-weight: 400;\">container_of actually works. Maybe we will cover that once I finished this exercise.<\/span><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">But, let&#8217;s briefly see what is the use of this container_of macro.<\/span><\/p>\n<ol class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">The container_of macro helps you to get the address of the containing structure by taking the address of its member element.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">As its name indicates, it gives you the &#8220;container&#8221; address of the member element of a structure.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">It takes three arguments. One is a pointer, the second one is type of the container, and the third one is name of the member the pointer refers to.<\/span><\/li>\n<\/ol>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">It actually takes three arguments, as shown in Figure 9. Let me explain those arguments.<\/span><\/p>\n<figure id=\"attachment_8951\" aria-describedby=\"caption-attachment-8951\" style=\"width: 655px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-8951\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/04\/Figure-9-2.png\" alt=\"Figure 9. Container of macro parameters\" width=\"655\" height=\"292\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-9-2.png 655w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-9-2-300x134.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-9-2-600x267.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-9-2-120x53.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-9-2-500x223.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-9-2-200x89.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-9-2-400x178.png 400w\" sizes=\"(max-width: 655px) 100vw, 655px\" \/><figcaption id=\"caption-attachment-8951\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 9. Container of macro parameters<\/span><\/figcaption><\/figure>\n<p data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">Pointer, type, and member. The pointer is pointer to the member. And the second argument is type of&nbsp;<\/span><span style=\"font-weight: 400;\">the container struct in which the &#8216;member&#8217; is embedded in. And the third argument is member; here, you should give the member name. Name of the member where the pointer refers to.<\/span><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Let&#8217;s use this container_of. Remember that we are using container_of to extract this member elements parent structure. Let&#8217;s get back to the open method. Let me use the container_of().<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">As I said, inode gives me the address of the device-specific cdev. That&#8217;s why I&#8217;m going to use inode, and I&#8217;m going to dereference it, and I&#8217;m going to use i_cdev. This is a pointer. And the next argument is type of the container struct. What is a container struct? That is struct pcdev_private_data. And the third argument is member name. Member&nbsp; name is cdev. This is a member name.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<figure id=\"attachment_8952\" aria-describedby=\"caption-attachment-8952\" style=\"width: 756px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-8952\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/04\/Figure-10-2.png\" alt=\"Figure 10. Container of macro implementation in our code\" width=\"756\" height=\"380\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-10-2.png 756w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-10-2-300x151.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-10-2-600x302.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-10-2-120x60.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-10-2-500x251.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-10-2-540x272.png 540w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-10-2-200x101.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-10-2-400x201.png 400w\" sizes=\"(max-width: 756px) 100vw, 756px\" \/><figcaption id=\"caption-attachment-8952\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 10. Container of macro implementation in our code<\/span><\/figcaption><\/figure>\n<p data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">After that, that private data structure is really required for our other methods. For example, for&nbsp;<\/span><span style=\"font-weight: 400;\">read method and write method. Remember that, from the read method you cannot extract that.&nbsp;<\/span><span style=\"font-weight: 400;\">Why? Because there is no supply of inode. So, the VFS doesn&#8217;t supply inode to the read or write method.<\/span><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">That&#8217;s why it must be done in the open method. You have to save this for other methods. Because other methods also want to operate on that device private data, isn&#8217;t it? It has to manipulate other methods also manipulate the permission, or the buffer field, etc. That&#8217;s why you have to save this(<\/span><b>pcdev_data<\/b><span style=\"font-weight: 400;\">).&nbsp;<\/span><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">So, where do you save this? You save this data(<\/span><b>pcdev_data)<\/b><span style=\"font-weight: 400;\"> inside the file struct. Because, once a device is opened, a struct file kernel object is created, and the same kernel object is passed to different driver methods like read and write.<\/span><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Read and write, even lseek, all these a driver methods receive the same kernel object(struct file *filp). That&#8217;s why, you save that device private data inside this struct file.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">We can do that by using one interesting field in this structure called private_data. So, will see that.&nbsp;<\/span><span style=\"font-weight: 400;\">Let&#8217;s search for struct file. Now, if you just check this file structure, you can see that, there is a field&nbsp;<\/span><span style=\"font-weight: 400;\">called private_data.<\/span><\/span><\/p>\n<figure id=\"attachment_8953\" aria-describedby=\"caption-attachment-8953\" style=\"width: 755px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-8953\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/04\/Figure-11-2.png\" alt=\"Figure 11.*private_data field in struct file\" width=\"755\" height=\"391\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-11-2.png 755w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-11-2-300x155.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-11-2-600x311.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-11-2-120x62.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-11-2-500x259.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-11-2-200x104.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-11-2-400x207.png 400w\" sizes=\"(max-width: 755px) 100vw, 755px\" \/><figcaption id=\"caption-attachment-8953\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 11. *private_data field in struct file<\/span><\/figcaption><\/figure>\n<p data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">You can use this private_data field in order to supply a device&nbsp; private data to other methods of the&nbsp;<\/span><span style=\"font-weight: 400;\">driver such as read, write, lseek.<\/span><\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Let&#8217;s get back to the code. And what I&#8217;m going to do now is, I&#8217;m going to use this file pointer, dereference that. Let&#8217;s use the private_data field in order to store this pointer&nbsp; pcdev_data.<\/span><\/p>\n<figure id=\"attachment_8954\" aria-describedby=\"caption-attachment-8954\" style=\"width: 756px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-8954 size-full\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/04\/Figure-12-2.png\" alt=\"Pcd driver\" width=\"756\" height=\"355\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-12-2.png 756w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-12-2-300x141.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-12-2-600x282.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-12-2-120x56.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-12-2-500x235.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-12-2-200x94.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-12-2-400x188.png 400w\" sizes=\"(max-width: 756px) 100vw, 756px\" \/><figcaption id=\"caption-attachment-8954\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 12. File pointer implementation in our code<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">And after that, the open method also should check the permission. Because, for example, in our case, the pcdev1 device is read-only. That&#8217;s why the user application should not try to open the device file of pcdev1 with read-write access. So, the driver should detect that, and it should then report whether the open was successful or not. That&#8217;s why the permission checking should be done in the open method.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">I will implement the permission checking later. For a time being, let me implement this check_permission as shown in Figure 13. So, check_permission. Let&#8217;s for a time being, let&#8217;s keep it void. And let&#8217;s just return 0. The permission is granted,&nbsp; something like that.<\/span><\/p>\n<figure id=\"attachment_8955\" aria-describedby=\"caption-attachment-8955\" style=\"width: 756px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-8955 size-full\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/04\/Figure-13-2.png\" alt=\"Pcd driver\" width=\"756\" height=\"381\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-13-2.png 756w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-13-2-300x151.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-13-2-600x302.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-13-2-120x60.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-13-2-500x252.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-13-2-540x272.png 540w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-13-2-200x101.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-13-2-400x202.png 400w\" sizes=\"(max-width: 756px) 100vw, 756px\" \/><figcaption id=\"caption-attachment-8955\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 13. Check_perminssion function<\/span><\/figcaption><\/figure>\n<p data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Once we finished coding for all the methods will come back to this open method and will finish this check_permission.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">And after that, the final line is if the return is non-zero, then the open method of the driver concludes&nbsp;<\/span><span style=\"font-weight: 400;\">that the open was unsuccessful and return the error code as shown in Figure 14.<\/span><\/span><\/p>\n<figure id=\"attachment_8956\" aria-describedby=\"caption-attachment-8956\" style=\"width: 754px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-8956 size-full\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/04\/FIgure-14.png\" alt=\"Pcd driver\" width=\"754\" height=\"381\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/FIgure-14.png 754w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/FIgure-14-300x152.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/FIgure-14-600x303.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/FIgure-14-120x61.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/FIgure-14-500x253.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/FIgure-14-540x272.png 540w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/FIgure-14-200x101.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/FIgure-14-400x202.png 400w\" sizes=\"(max-width: 754px) 100vw, 754px\" \/><figcaption id=\"caption-attachment-8956\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 14. Conclusion of open method driver(successful or unsuccessful)<\/span><\/figcaption><\/figure>\n<p data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Check_permission basically returns an error code or zero. So, we&#8217;ll implement that later.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">I think we have come to the end of this open method and now let&#8217;s save this and try to build it. In the following article, let&#8217;s implement read and write. I will see you in the following article.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 20px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000080;\"><b>FastBit Embedded Brain Academy Courses<\/b><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-size: 17px;\"><span style=\"color: #000000;\">C<span style=\"font-weight: 400;\"><span style=\"color: #000000;\">lick here:<\/span><span style=\"color: #0000ff;\">&nbsp;<\/span><\/span><\/span><span style=\"color: #0000ff;\"><a style=\"color: #0000ff; text-decoration: underline;\" href=\"http:\/\/fastbitlab.com\/course1\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">https:\/\/fastbitlab.com\/course1<\/span><\/a><\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; Pcd driver with multiple devices code implementation part-5 &nbsp; &nbsp; In this article, let&#8217;s implement the pcd_open method(Shown in Figure 1). &nbsp; As you know, the open method of the driver gets called whenever the user space application tries to open our device file. In this open method, the virtual file system actually provides [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":8951,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"0","ocean_second_sidebar":"0","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"0","ocean_custom_header_template":"0","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"0","ocean_menu_typo_font_family":"0","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"0","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"off","ocean_gallery_id":[],"footnotes":""},"categories":[8],"tags":[18],"class_list":["post-8939","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-linux-device-driver-programming","entry","has-media"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Pcd driver with multiple devices code implementation part-5 | LDD1<\/title>\n<meta name=\"description\" content=\"Pcd driver with multiple devices code implementation part-5. The open method of the driver gets called whenever the user space application\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/fastbitlab.com\/blog\/pcd-driver-with-multiple-devices-code-implementation-part-5\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Pcd driver with multiple devices code implementation part-5 | LDD1\" \/>\n<meta property=\"og:description\" content=\"Pcd driver with multiple devices code implementation part-5. The open method of the driver gets called whenever the user space application\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fastbitlab.com\/blog\/pcd-driver-with-multiple-devices-code-implementation-part-5\/\" \/>\n<meta property=\"og:site_name\" content=\"FastBit EBA\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/fastbiteba\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-04-09T04:00:47+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-01-16T10:31:27+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-9-2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"655\" \/>\n\t<meta property=\"og:image:height\" content=\"292\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"FastBitLab\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@fastbiteba\" \/>\n<meta name=\"twitter:site\" content=\"@fastbiteba\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"FastBitLab\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/pcd-driver-with-multiple-devices-code-implementation-part-5\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/pcd-driver-with-multiple-devices-code-implementation-part-5\\\/\"},\"author\":{\"name\":\"FastBitLab\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/person\\\/e32b38e733a0d76ffa7e6bc998652e5d\"},\"headline\":\"Linux Device Driver Programming Lecture 53| Pcd driver with multiple devices code implementation part-5\",\"datePublished\":\"2022-04-09T04:00:47+00:00\",\"dateModified\":\"2023-01-16T10:31:27+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/pcd-driver-with-multiple-devices-code-implementation-part-5\\\/\"},\"wordCount\":1732,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/pcd-driver-with-multiple-devices-code-implementation-part-5\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/04\\\/Figure-9-2.png\",\"keywords\":[\"Linux Device Driver Programming Tutorial\"],\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/pcd-driver-with-multiple-devices-code-implementation-part-5\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/pcd-driver-with-multiple-devices-code-implementation-part-5\\\/\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/pcd-driver-with-multiple-devices-code-implementation-part-5\\\/\",\"name\":\"Pcd driver with multiple devices code implementation part-5 | LDD1\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/pcd-driver-with-multiple-devices-code-implementation-part-5\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/pcd-driver-with-multiple-devices-code-implementation-part-5\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/04\\\/Figure-9-2.png\",\"datePublished\":\"2022-04-09T04:00:47+00:00\",\"dateModified\":\"2023-01-16T10:31:27+00:00\",\"description\":\"Pcd driver with multiple devices code implementation part-5. The open method of the driver gets called whenever the user space application\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/pcd-driver-with-multiple-devices-code-implementation-part-5\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/pcd-driver-with-multiple-devices-code-implementation-part-5\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/pcd-driver-with-multiple-devices-code-implementation-part-5\\\/#primaryimage\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/04\\\/Figure-9-2.png\",\"contentUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/04\\\/Figure-9-2.png\",\"width\":655,\"height\":292,\"caption\":\"Figure 9. Container of macro parameters\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/pcd-driver-with-multiple-devices-code-implementation-part-5\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux Device Driver Programming Lecture 53| Pcd driver with multiple devices code implementation part-5\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\",\"name\":\"FastBit EBA\",\"description\":\"Your Online Academy of Embedded Systems\",\"publisher\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\",\"name\":\"FastBit EBA\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/logo-EzNrEnyr.png\",\"contentUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/logo-EzNrEnyr.png\",\"width\":640,\"height\":640,\"caption\":\"FastBit EBA\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/fastbiteba\\\/\",\"https:\\\/\\\/x.com\\\/fastbiteba\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/fastbit-embedded-brain-academy-b3167b124\\\/\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCa1REBV9hyrzGp2mjJCagBg\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/person\\\/e32b38e733a0d76ffa7e6bc998652e5d\",\"name\":\"FastBitLab\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"caption\":\"FastBitLab\"},\"description\":\"The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Pcd driver with multiple devices code implementation part-5 | LDD1","description":"Pcd driver with multiple devices code implementation part-5. The open method of the driver gets called whenever the user space application","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/fastbitlab.com\/blog\/pcd-driver-with-multiple-devices-code-implementation-part-5\/","og_locale":"en_US","og_type":"article","og_title":"Pcd driver with multiple devices code implementation part-5 | LDD1","og_description":"Pcd driver with multiple devices code implementation part-5. The open method of the driver gets called whenever the user space application","og_url":"https:\/\/fastbitlab.com\/blog\/pcd-driver-with-multiple-devices-code-implementation-part-5\/","og_site_name":"FastBit EBA","article_publisher":"https:\/\/www.facebook.com\/fastbiteba\/","article_published_time":"2022-04-09T04:00:47+00:00","article_modified_time":"2023-01-16T10:31:27+00:00","og_image":[{"width":655,"height":292,"url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-9-2.png","type":"image\/png"}],"author":"FastBitLab","twitter_card":"summary_large_image","twitter_creator":"@fastbiteba","twitter_site":"@fastbiteba","twitter_misc":{"Written by":"FastBitLab","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fastbitlab.com\/blog\/pcd-driver-with-multiple-devices-code-implementation-part-5\/#article","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/pcd-driver-with-multiple-devices-code-implementation-part-5\/"},"author":{"name":"FastBitLab","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/person\/e32b38e733a0d76ffa7e6bc998652e5d"},"headline":"Linux Device Driver Programming Lecture 53| Pcd driver with multiple devices code implementation part-5","datePublished":"2022-04-09T04:00:47+00:00","dateModified":"2023-01-16T10:31:27+00:00","mainEntityOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/pcd-driver-with-multiple-devices-code-implementation-part-5\/"},"wordCount":1732,"commentCount":0,"publisher":{"@id":"https:\/\/fastbitlab.com\/blog\/#organization"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/pcd-driver-with-multiple-devices-code-implementation-part-5\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-9-2.png","keywords":["Linux Device Driver Programming Tutorial"],"articleSection":["Blog"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fastbitlab.com\/blog\/pcd-driver-with-multiple-devices-code-implementation-part-5\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fastbitlab.com\/blog\/pcd-driver-with-multiple-devices-code-implementation-part-5\/","url":"https:\/\/fastbitlab.com\/blog\/pcd-driver-with-multiple-devices-code-implementation-part-5\/","name":"Pcd driver with multiple devices code implementation part-5 | LDD1","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/pcd-driver-with-multiple-devices-code-implementation-part-5\/#primaryimage"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/pcd-driver-with-multiple-devices-code-implementation-part-5\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-9-2.png","datePublished":"2022-04-09T04:00:47+00:00","dateModified":"2023-01-16T10:31:27+00:00","description":"Pcd driver with multiple devices code implementation part-5. The open method of the driver gets called whenever the user space application","breadcrumb":{"@id":"https:\/\/fastbitlab.com\/blog\/pcd-driver-with-multiple-devices-code-implementation-part-5\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fastbitlab.com\/blog\/pcd-driver-with-multiple-devices-code-implementation-part-5\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fastbitlab.com\/blog\/pcd-driver-with-multiple-devices-code-implementation-part-5\/#primaryimage","url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-9-2.png","contentUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/04\/Figure-9-2.png","width":655,"height":292,"caption":"Figure 9. Container of macro parameters"},{"@type":"BreadcrumbList","@id":"https:\/\/fastbitlab.com\/blog\/pcd-driver-with-multiple-devices-code-implementation-part-5\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fastbitlab.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Linux Device Driver Programming Lecture 53| Pcd driver with multiple devices code implementation part-5"}]},{"@type":"WebSite","@id":"https:\/\/fastbitlab.com\/blog\/#website","url":"https:\/\/fastbitlab.com\/blog\/","name":"FastBit EBA","description":"Your Online Academy of Embedded Systems","publisher":{"@id":"https:\/\/fastbitlab.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fastbitlab.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/fastbitlab.com\/blog\/#organization","name":"FastBit EBA","url":"https:\/\/fastbitlab.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2026\/04\/logo-EzNrEnyr.png","contentUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2026\/04\/logo-EzNrEnyr.png","width":640,"height":640,"caption":"FastBit EBA"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/fastbiteba\/","https:\/\/x.com\/fastbiteba","https:\/\/www.linkedin.com\/in\/fastbit-embedded-brain-academy-b3167b124\/","https:\/\/www.youtube.com\/channel\/UCa1REBV9hyrzGp2mjJCagBg"]},{"@type":"Person","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/person\/e32b38e733a0d76ffa7e6bc998652e5d","name":"FastBitLab","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","caption":"FastBitLab"},"description":"The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries."}]}},"_links":{"self":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/8939","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/comments?post=8939"}],"version-history":[{"count":5,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/8939\/revisions"}],"predecessor-version":[{"id":12805,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/8939\/revisions\/12805"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media\/8951"}],"wp:attachment":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media?parent=8939"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/categories?post=8939"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/tags?post=8939"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}