00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00034 #include <strings.h>
00035 #include <liberipc/eripcbusyd.h>
00036 #include <liberipc/eripccontentlister.h>
00037
00038
00039 #define CF_ID "CF"
00040 #define SD_ID "SD"
00041 #define USB_ID "USB"
00042
00043 static erClientChannel_t contentListerChannel;
00044
00045 static void usage(void)
00046 {
00047 printf("Usage: clNotify <event> <present>\n"
00048 " <event>: is CF, SD or USB\n"
00049 " <present>: 1 or 0\n\n");
00050 }
00051
00052 int main(int argc, char *argv[])
00053 {
00054 char device[5] = "";
00055 int present = 0;
00056
00057 if ( argc != 3 )
00058 {
00059 usage();
00060 return 1;
00061 }
00062
00063
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 }