/driver/usb/storage/usb.c 에 가르쳐 주신대로 하니 잘 됩니다.
static void * storage_probe(struct usb_device *dev, unsigned int ifnum,
const struct usb_device_id *id)
{
int i;
const int id_index = id - storage_usb_ids;
char mf[USB_STOR_STRING_LEN]; /* manufacturer */
char prod[USB_STOR_STRING_LEN]; /* product */
char serial[USB_STOR_STRING_LEN]; /* serial number */
GUID(guid); /* Global Unique Identifier */
unsigned int flags;
struct us_unusual_dev *unusual_dev;
struct us_data *ss = NULL;
////////////////////////////////////////////////////////////////////////////////
//Appended by starpath
int ret;
char *argv[4];
char *envp[] ={ "HOME=/", "PATH=/sbin:/usr/sbin:/bin:/usr/bin", NULL };
//..Appended
///////////////////////////////////////////////////////////////////////////////
#ifdef CONFIG_USB_STORAGE_SDDR09
int result;
#endif
요걸 불러들입니다.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#define USB_MOUNTED 0x01
#define USB_UMOUNTED 0x02
#define MMC_MOUNTED 0x04
#define MMC_UMOUNTED 0x08
/*
void send_sig_to_rec(int pid, int value)
{
union sigval sv;
if (pid < 0)
return;
sv.sival_int = value;
sigqueue(pid, SIGRTMIN, sv);
}//send_sig_to_rec()
*/
int main(int argc, char *argv[])
{
char mnt_buf[512];
//int pidfile, rec_pid = -1;
int retval = 256;
printf("Automnt %s.............n", argv[1]);
if (!strcasecmp(argv[1], "probe"))
{
if (access("/dev/discs/disc1/part1", F_OK) == 0)
{
sprintf(mnt_buf, "mount -t vfat -o rw /dev/discs/disc1/part1 /mnt/USB");
retval = system(mnt_buf);
if (!retval)
{
//send_sig_to_rec(rec_pid, USB_MOUNTED);
return retval;
}
}//if
}//if
else if (!strcasecmp(argv[1], "disconnect"))
{
if (access("/dev/discs/disc1/part1", F_OK) == 0)
{
retval = system("umount /mnt/USB");
return retval;
}//if
}//else if
return -1;
}//main()
많은 도움이 되었습니다. 감사합니다.