EmbLogic's Blog

sysfs

Kobjects are the mechanism behind the sysfs virtual filesystem. For every directory
found in sysfs, there is a kobject lurking somewhere within the kernel. Every kobject
of interest also exports one or more attributes, which appear in that kobject’s sysfs
directory as files containing kernel-generated information.Code that works with sysfs should include <linux/sysfs.h>.

Posted in Uncategorized | 1 Comment

kobject

Adding a kobject to a kset is usually done when the object is created; it is a two-step
process. The kobject’s kset field must be pointed at the kset of interest; then the
kobject should be passed to:
int kobject_add(struct kobject *kobj);
As always, programmers should be aware that this function can fail (in which case it
returns a negative error code) and respond accordingly. There is a convenience func-
tion provided by the kernel:
extern int kobject_register(struct kobject *kobj);

Posted in Uncategorized | Leave a comment

i2c probe and attach functions.

When the i2c core calls the driver’s probe() method signifying the presence of a host adapter, it, in turn,invokes i2c_probe() with arguments specifying the addresses of the slave devices that the driver is responsible for and an associated attach() routine,which registers a per-device client data structure.

Posted in Uncategorized | Leave a comment

class object

Each class object includes a list of class_device descriptors, each of which represents a single logical device belonging to the class. The class_device structure includes a dev field that points to a device descriptor, thus a logical device always refers to a given device in the device driver model. However, there can be several class_device descriptors that refer to the same device. In fact, a hardware device might include several different sub-devices, each of which requires a different User Mode interface.

Posted in Uncategorized | Leave a comment

i2c

I2C is the name for a two-wire serial bus protocol originally developed by Phillips. It commonly is used in embedded systems so different components can communicate; PC motherboards use I2C to talk to different sensor chips. Those sensors typically report back fan speeds, processor temperatures and a whole raft of system hardware information.

Posted in Uncategorized | Leave a comment

Apple iphone

How to copy and move files between Apple iphone and PC ?

Posted in Uncategorized | Leave a comment

Dentry Object

VFS considers each directory a file that contains a list of files and other directories.Once a directory entry is read into memory, however, it is transformed by the VFS into a dentry object based on the dentry structure.The kernel creates a dentry object for every component of a pathname that a process looks up; the dentry object associates the component to its corresponding inode. For example, when looking up the /tmp/test pathname, the kernel creates a dentry object for the / root directory, a second dentry object for the tmp entry of the root directory, and a third dentry object for the test entry of the /tmp directory.

Posted in Uncategorized | Leave a comment

Process Switching

In order to control the execution of processes, the kernel must be able to suspend the
execution of the process running on the CPU and resume the execution of some other process previously suspended. This activity is called process switching , task switching, or context switching. The following sections describe the elements of process switching in Linux:

•Hardware support
•Linux code
•Saving the floating point registers
•Hardware context.

Posted in Uncategorized | Leave a comment

what is the meaning of “core dumped”.

Posted in Uncategorized | 2 Comments

usb pipe

While the device sends and receives data on a series of endpoints, the client software transfers data through pipes. A pipe is a logical connection between the host and endpoint(s). Pipes will also have a set of parameters associated with them such as how much bandwidth is allocated to it, what transfer type (Control, Bulk, Iso or Interrupt) it uses, a direction of data flow and maximum packet/buffer sizes.

Posted in Uncategorized | Leave a comment

usb

Disconnect()

In the disconnect function, it is also important to retrieve from the interface any data
that was previously set with a call to usb_set_intfdata. Then set the data pointer in
the struct usb_interface structure to NULL to prevent any further mistakes in access-
ing the data improperly

Posted in Uncategorized | Leave a comment

USB handshake Packets

  • Handshake Packets
    • ACK – Acknowledgment that the packet has been successfully received.
    • NAK – Reports that the device temporary cannot send or received data. Also used during interrupt transactions to inform the host there is no data to send.
    • STALL – The device finds its in a state that it requires intervention from the host.
Posted in Uncategorized | Leave a comment

usb

probe function

In the probe function the USB driver should initialize any local structures
that it might use to manage the USB device. It should also save any information that
it needs about the device to the local structure, as it is usually easier to do so at this
time. As an example, USB drivers usually want to detect what the endpoint address
and buffer sizes are for the device, as they are needed in order to communicate with
the device.

Posted in Uncategorized | Leave a comment

Standard Descriptors

A Device Descriptor describes general information about a USB device. It includes information that applies globally to the device and all of the device’s configurations. A USB device has only one device descriptor.

Posted in Uncategorized | Leave a comment

Linux-hotplug

To enable the linux-hotplug system to load the driver automatically when the device is plugged in, you need to create a MODULE_DEVICE_TABLE. The following code tells the hotplug scripts that this module supports a single device with a specific vendor and product ID:

/* table of devices that work with this driver */
static struct usb_device_id skel_table [] = {
    { USB_DEVICE(USB_SKEL_VENDOR_ID,
      USB_SKEL_PRODUCT_ID) },
    { }                      /* Terminating entry */
};
MODULE_DEVICE_TABLE (usb, skel_table);
Posted in Uncategorized | 1 Comment