Exemplo n.º 1
0
uint64_t MtpStorage::getFreeSpace() {
    struct statfs   stat;
    if (statfs(getPath(), &stat))
        return -1;
    uint64_t freeSpace = (uint64_t)stat.f_bavail * (uint64_t)stat.f_bsize;

    //ALPS00120037,Added for USB Develpment debug, more log for more debuging help
    sxlog_printf(ANDROID_LOG_DEBUG, "MtpStorage",
                 "MtpStorage::getFreeSpace: freeSpace = %lld,  mReserveSpace = %lld \n", freeSpace, mReserveSpace);
    //ALPS00120037,Added for USB Develpment debug, more log for more debuging help

    return (freeSpace > mReserveSpace ? freeSpace - mReserveSpace : 0);
}
Exemplo n.º 2
0
uint64_t MtpStorage::getMaxCapacity() {
    if (mMaxCapacity == 0) {
        struct statfs   stat;
        if (statfs(getPath(), &stat))
            return -1;
        mMaxCapacity = (uint64_t)stat.f_blocks * (uint64_t)stat.f_bsize;
    }

    //ALPS00120037,Added for USB Develpment debug, more log for more debuging help
    sxlog_printf(ANDROID_LOG_DEBUG, "MtpStorage",
                 "MtpStorage::getMaxCapacity: mMaxCapacity = %lld \n", mMaxCapacity);
    //ALPS00120037,Added for USB Develpment debug, more log for more debuging help

    return mMaxCapacity;
}
Exemplo n.º 3
0
MtpStorage::MtpStorage(MtpStorageID id, const char* filePath,
                       const char* description, uint64_t reserveSpace,
                       bool removable, uint64_t maxFileSize)
    :   mStorageID(id),
        mFilePath(filePath),
        mDescription(description),
        mMaxCapacity(0),
        mMaxFileSize(maxFileSize),
        mReserveSpace(reserveSpace),
        mRemovable(removable)
{
    LOGV("MtpStorage id: 0x%08x path: %s\n", id, filePath);
    //Added for USB Develpment debug, more log for more debuging help
    sxlog_printf(ANDROID_LOG_DEBUG, "MtpStorage",
                 "MtpStorage id: 0x%08x path: %s\n", id, filePath);
    //Added for USB Develpment debug, more log for more debuging help
}
Exemplo n.º 4
0
int MtpEventPacket::write(int fd) {
    struct mtp_event    event;

    putUInt32(MTP_CONTAINER_LENGTH_OFFSET, mPacketSize);
    putUInt16(MTP_CONTAINER_TYPE_OFFSET, MTP_CONTAINER_TYPE_EVENT);

    event.data = mBuffer;
    event.length = mPacketSize;
    int ret = ::ioctl(fd, MTP_SEND_EVENT, (unsigned long)&event);

    //Added for USB Develpment debug, more log for more debuging help
    sxlog_printf(ANDROID_LOG_VERBOSE, "MtpEventPacket",
                "%s: mBuffer = %p, mPacketSize = 0x%d, &event = %p \n", __func__, mBuffer, mPacketSize, (&event));
    //Added for USB Develpment debug, more log for more debuging help

    return (ret < 0 ? ret : 0);
}