powerMgr/src/notify.c File Reference

clNotify More...

#include <strings.h>
#include <liberipc/eripcbusyd.h>
#include <liberipc/eripccontentlister.h>

Go to the source code of this file.

Defines

#define CF_ID   "CF"
#define SD_ID   "SD"
#define USB_ID   "USB"

Functions

static void usage (void)
int main (int argc, char *argv[])

Variables

static erClientChannel_t contentListerChannel


Detailed Description

clNotify

Copyright (C) 2005-2008 iRex Technologies B.V. All rights reserved.

Definition in file notify.c.


Define Documentation

#define CF_ID   "CF"

eReader CTL USB/CF event notifier This program is called from the hotplug scripts and notifies the CL of a change of state on the USB or CF bus

Definition at line 39 of file notify.c.

#define SD_ID   "SD"

Definition at line 40 of file notify.c.

#define USB_ID   "USB"

Definition at line 41 of file notify.c.


Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 52 of file notify.c.

00053 {
00054     char device[5] = "";
00055     int present = 0;
00056     
00057     if ( argc != 3 )
00058     {
00059         usage();
00060         return 1;
00061     }
00062     
00063     // Check 'present' parameter. If not used correctly, make it 0
00064     present = atoi(argv[2]);
00065     if (present != 1)
00066     {
00067         present = 0;
00068     }
00069     
00070     if (strcasecmp(CF_ID, argv[1]) == 0)
00071     {
00072         strcpy(device, CF_ID);
00073     }
00074     else if (strcasecmp(SD_ID, argv[1]) == 0)
00075     {
00076         strcpy(device, SD_ID);
00077     }
00078     else if (strcasecmp(USB_ID, argv[1]) == 0)
00079     {
00080         strcpy(device, USB_ID);
00081     }
00082     else
00083     {
00084         usage();
00085         return 1;
00086     }
00087 
00088 #ifdef DEBUG
00089     printf("clNotify: %s is now %s\n", device, (present == 1) ? "present" : "removed");
00090 #endif
00091     
00092     erIpcStartClient(erIpcGetChannel(ER_CONTENT_LISTER_UA_ID), &contentListerChannel);
00093     clStoragePresent(contentListerChannel, device, present);
00094     return 0;
00095 }

Here is the call graph for this function:

static void usage ( void   )  [static]

Definition at line 45 of file notify.c.

00046 {
00047     printf("Usage: clNotify <event> <present>\n"
00048         "       <event>: is CF, SD or USB\n"
00049                 "       <present>: 1 or 0\n\n");
00050 }


Variable Documentation

Definition at line 43 of file notify.c.


Generated on Sun Dec 14 17:14:19 2008 by  doxygen 1.5.6