Main Page | Class List | File List | Class Members | File Members | Related Pages

src/lib/device.c File Reference

Device interface routes. More...

#include <linux/types.h>
#include <assert.h>
#include <string.h>
#include <otto/otto.h>
#include <otto/packet.h>
#include <otto/device.h>
#include <otto/control.h>

Functions

const char _ID_[] __attribute__ ((unused))="$Id: device.c,v 1.1 2004/07/07 22:07:12 alpha Exp $"
void otto_register (struct otto_driver *drv)
 Register a device driver.

otto_deviceotto_open (const char *name, const char *fname)
 Open and initialize OBD2 device.

int otto_close (struct otto_device *dev)
 Close ODB2 device.

int otto_write (struct otto_device *dev, int bus, union otto_packet *packet, size_t size)
 Transmit a packet on an OBD2 device.

int otto_read (struct otto_device *dev, int bus, union otto_packet *packet, size_t size)
 Receive a packet on an OBD2 device.

int otto_control (struct otto_device *dev, int bus, void *data, int cmd)
 Control for device.

int otto_getselectfd (struct otto_device *dev)
 Return a file descriptor for select() or poll().


Variables

otto_driverg_drv_first = NULL
 List of drivers.


Detailed Description

Device interface routes.

Todo:
allocate/free otto_device/otto_bus structures dynamically in this lib

Function Documentation

const char _ID_ [] __attribute__ (unused)   )  [static]
 

int otto_close struct otto_device dev  ) 
 

Close ODB2 device.

Todo:
remove dev from dev->drv->dev_first list
Parameters:
dev  OBD2 device

int otto_control struct otto_device dev,
int  bus,
void *  data,
int  cmd
 

Control for device.

Returns:
Depends on function
Parameters:
dev  Otto device handle
bus  Device bus number
data  Pointer to optional parameters, depending on function
cmd  Function identifier

int otto_getselectfd struct otto_device dev  ) 
 

Return a file descriptor for select() or poll().

Returns:
file descriptor

struct otto_device* otto_open const char *  name,
const char *  fname
 

Open and initialize OBD2 device.

Returns:
Otto device handle

Todo:
add dev to dev->drv->dev_first list
Parameters:
name  Name of driver to use
fname  Name of device file to use

int otto_read struct otto_device dev,
int  bus,
union otto_packet packet,
size_t  size
 

Receive a packet on an OBD2 device.

Parameters:
dev  Otto device handle
bus  OBD2 bus interface
packet  Received packet
size  Size of the packet parameter

void otto_register struct otto_driver drv  ) 
 

Register a device driver.

Parameters:
drv  Device driver operations

int otto_write struct otto_device dev,
int  bus,
union otto_packet packet,
size_t  size
 

Transmit a packet on an OBD2 device.

Parameters:
dev  Otto device handle
packet  /< Device bus interface Packet to send
size  Size of packet structure


Variable Documentation

struct otto_driver* g_drv_first = NULL [static]
 

List of drivers.


Generated on Thu Jul 8 19:26:07 2004 for OpenOtto by doxygen 1.3.7