Consider this scenario: you've successfully developed a device driver for, say, a pressure sensor device (perhaps by using the kernel's I2C APIs to fetch the pressure from the chip via the I2C protocol). So, you have the current pressure value in a variable within the driver, which of course implies that it's within kernel memory space. The issue at hand is, how exactly do you now have a user space application retrieve this value? Well, as we learned in the previous chapter, you can always include a .read method in the driver's fops structure. When the user space app issues a read(2) system call, control will be diverted (via the virtual file system (VFS)) to your driver's read method. In there, you perform copy_to_user() (or equivalent), resulting in the user mode app receiving the value. However, but...
United States
Great Britain
India
Germany
France
Canada
Russia
Spain
Brazil
Australia
Singapore
Hungary
Ukraine
Luxembourg
Estonia
Lithuania
South Korea
Turkey
Switzerland
Colombia
Taiwan
Chile
Norway
Ecuador
Indonesia
New Zealand
Cyprus
Denmark
Finland
Poland
Malta
Czechia
Austria
Sweden
Italy
Egypt
Belgium
Portugal
Slovenia
Ireland
Romania
Greece
Argentina
Netherlands
Bulgaria
Latvia
South Africa
Malaysia
Japan
Slovakia
Philippines
Mexico
Thailand