Exemple #1
0
/* Send a request, possibly waiting for a reply */
static int
maciisi_send_request(struct adb_request* req, int sync)
{
	int i;
	static int dump_packet = 1;

	if (via == NULL) {
		req->complete = 1;
		return -ENXIO;
	}

	if (dump_packet) {
		printk(KERN_DEBUG "maciisi_send_request:");
		for (i = 0; i < req->nbytes; i++) {
			printk(" %.2x", req->data[i]);
		}
		printk("\n");
	}
	req->reply_expected = 1;
	
	i = maciisi_write(req);
	if (i)
		return i;
	
	if (sync) {
		while (!req->complete) {
			maciisi_poll();
		}
	}
	return 0;
}
Exemple #2
0
/* Send a request, possibly waiting for a reply */
static int
maciisi_send_request(struct adb_request* req, int sync)
{
    int i;

#ifdef DEBUG_MACIISI_ADB
    static int dump_packet = 0;
#endif

    if (via == NULL) {
        req->complete = 1;
        return -ENXIO;
    }

#ifdef DEBUG_MACIISI_ADB
    if (dump_packet) {
        printk(KERN_DEBUG "maciisi_send_request:");
        for (i = 0; i < req->nbytes; i++) {
            printk(" %.2x", req->data[i]);
        }
        printk(" sync %d\n", sync);
    }
#endif

    req->reply_expected = 1;
    
    i = maciisi_write(req);
    if (i)
    {
        /* Normally, if a packet requires syncing, that happens at the end of
         * maciisi_send_request. But if the transfer fails, it will be restarted
         * by maciisi_interrupt(). We use need_sync to tell maciisi_interrupt
         * when to sync a packet that it sends out.
         * 
         * Suggestions on a better way to do this are welcome.
         */
        if(i == -EBUSY && sync)
            need_sync = 1;
        else
            need_sync = 0;
        return i;
    }
    if(sync)
        maciisi_sync(req);
    
    return 0;
}
static int
maciisi_send_request(struct adb_request* req, int sync)
{
	int i;

#ifdef DEBUG_MACIISI_ADB
	static int dump_packet = 0;
#endif

	if (via == NULL) {
		req->complete = 1;
		return -ENXIO;
	}

#ifdef DEBUG_MACIISI_ADB
	if (dump_packet) {
		printk(KERN_DEBUG "maciisi_send_request:");
		for (i = 0; i < req->nbytes; i++) {
			printk(" %.2x", req->data[i]);
		}
		printk(" sync %d\n", sync);
	}
#endif

	req->reply_expected = 1;
	
	i = maciisi_write(req);
	if (i)
	{
		if(i == -EBUSY && sync)
			need_sync = 1;
		else
			need_sync = 0;
		return i;
	}
	if(sync)
		maciisi_sync(req);
	
	return 0;
}