Пример #1
0
static status_t
ethernet_link_checker(void *)
{
	while (true) {
		status_t status = acquire_sem_etc(sLinkChangeSemaphore, 1,
			B_RELATIVE_TIMEOUT, kLinkCheckInterval);
		if (status == B_BAD_SEM_ID)
			break;

		MutexLocker _(sListLock);

		if (sCheckList.IsEmpty())
			break;

		// check link state of all existing devices

		DoublyLinkedList<ethernet_device>::Iterator iterator
			= sCheckList.GetIterator();
		while (iterator.HasNext()) {
			update_link_state(iterator.Next());
		}
	}

	return B_OK;
}
Пример #2
0
static int
DumpHciConnections(int argc, char** argv)
{
    HciConnection* conn;
    L2capChannel* chan;
    L2capFrame* frame;
    DoublyLinkedList<HciConnection>::Iterator iterator
        = sConnectionList.GetIterator();

    while (iterator.HasNext()) {
        conn = iterator.Next();
        /*
        kprintf("LocalDevice=0x%" B_PRIx32 " Destination=%s handle=%#x type=%d"
        	"outqueue=%" B_PRId32 " expected=%" B_PRId32 "\n", conn->Hid,
        	bdaddrUtils::ToString(conn->destination).String(), conn->handle,
        	conn->type, conn->OutGoingFrames.Count(),
        	conn->ExpectedResponses.Count());
        */

        // each channel
        kprintf("\tChannels\n");
        DoublyLinkedList<L2capChannel>::Iterator channelIterator
            = conn->ChannelList.GetIterator();

        while (channelIterator.HasNext()) {
            chan = channelIterator.Next();
            kprintf("\t\tscid=%x dcid=%x state=%x cfg=%x\n", chan->scid,
                    chan->dcid, chan->state, chan->cfgState);
        }

        // Each outgoing
        kprintf("\n\tOutGoingFrames\n");
        DoublyLinkedList<L2capFrame>::Iterator frameIterator
            = conn->OutGoingFrames.GetIterator();
        while (frameIterator.HasNext()) {
            frame = frameIterator.Next();
            kprintf("\t\tscid=%x code=%x ident=%x type=%x, buffer=%p\n",
                    frame->channel->scid, frame->code, frame->ident,
                    frame->type, frame->buffer);
        }

        // Each expected
        kprintf("\n\tExpectedFrames\n");
        DoublyLinkedList<L2capFrame>::Iterator frameExpectedIterator
            = conn->ExpectedResponses.GetIterator();

        while (frameExpectedIterator.HasNext()) {
            frame = frameExpectedIterator.Next();
            kprintf("\t\tscid=%x code=%x ident=%x type=%x, buffer=%p\n",
                    frame->channel->scid, frame->code, frame->ident,
                    frame->type, frame->buffer);
        }
    }

    return 0;
}