/*
 *               Copyright (C) 2005, BroadOn Communications Corp.
 *
 *  These coded instructions, statements, and computer programs contain
 *  unpublished  proprietary information of BroadOn Communications Corp.,
 *  and  are protected by Federal copyright law. They may not be disclosed
 *  to  third  parties or copied or duplicated in any form, in whole or in
 *  part, without the prior written consent of BroadOn Communications Corp.
 *
 */
#include <iostypes.h>
#include <ios.h>
#include <iop.h>
#include <ioslibc.h>

#ifndef ENABLE_TEST
#define STACK_SIZE 2048
const u8        _initStack[STACK_SIZE];
const u32       _initStackSize = sizeof(_initStack);
const u32       _initPriority = 20;
#endif /* ENABLE_TEST */

/* Sample mouse driver */
#include "iosusbtypes.h"
#include "iosusb.h"

#ifdef ENABLE_TEST
void
ohci_test(u32 arg)
#else
void
main(u32 arg)
#endif
{
    IOSFd fd0;

    usleep(5000000);
    fd0 = IOS_Open("/dev/usb/oh0/046d/c016", 0); /* logitech mouse */
    if (fd0 < 0) {
        fd0 = IOS_Open("/dev/usb/oh0/046d/c222", 0); /* G15 */
    } else {
        printf("opened mouse\n");
    }
    printf("opened fd = %d\n", fd0);
    while (1) {
        printf("test: suspending device for 5s\n");
        IUSB_SuspendDevice(fd0);
        usleep(100000);
        IUSB_ResumeDevice(fd0);
        printf("test: resumed device\n");
        usleep(100000);
    }
    IOS_Close(fd0);
    IOS_DestroyThread(0, NULL);
    return;
}
