Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>For 2, take a look at the folder:</p> <p><code>drivers/net/wireless/ath/carl9170/</code></p> <p>This folder is located under your kernel source directory. It contains all the sources of the driver.</p> <p>For 1:</p> <p>It is pretty much how classes works on oriented object programming: how does an object know which instance of the data it must work with? The <code>this</code> pointer references the correct in memory data.</p> <p>Take a look at the file <code>drivers/net/wireless/ath/carl9170/carl9170.h</code>. Every function exported by the driver is declared at this file. Note that every function has at its first parameter a reference to the <code>struct ar9170</code> data type. This is exactly the data set that the driver must work with. It specifies everything the driver need to know about the device and its sates, since the USB buses address where the device is connected, to the state of the device, like its power, connection state and any other data the driver itself need in order to keep the device working properly.</p> <p>Note that this is driver internal data thought. The kernel has its own set of data to keep both the driver, the device and the kernel itself working.</p> <p>Take a look at the 546 line of <a href="https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/drivers/net/wireless/ath/carl9170/carl9170.h?id=refs/tags/v3.8.8" rel="nofollow">carl9170.h</a>. It is where the function declarations starts. This file is as of the kernel 3.8.8.</p> <p>Just like in Object Oriented Programming you would allocate as many instances of a class as you need, the kernel will allocate as many <code>ar9170</code> structures a it needs, one referencing each device.</p> <p>The device ids can be obtained under the <code>/sys/class/net</code> directory. There will be a soft link for each of the network devices attached to your computer. This link will point the device to something like the following:</p> <pre><code>$ ls -l eth0 ../../devices/pci0000:00/0000:00:04.0/0000:02:00.0/net/eth0 </code></pre> <p>The <code>pci0000:00</code> is the bus. The <code>0000:00:04.0</code> I believe is the bus address. Finally, the <code>0000:02:00.0</code> is the device id. Afaik, every registered device follows the same logic.</p> <p>Finally, if you have two <code>carl9170</code> devices, both will be under the directory <code>/sys/class/net</code> but probably one of them will be named <code>wifi0</code> and the other <code>wifi1</code>. Also, each of them will point to different devices (check it with the command <code>ls -l /sys/class/net</code>).</p> <p>I just would like to note that in the explanation I haven't used any wireless card. So I'm not sure whether wireless cards are shown under <code>/sys/class/net</code> or not. Anyway, it will be something very similar, like <code>/sys/class/wireless</code>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload