Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8311931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:58:46+00:00 2026-06-08T19:58:46+00:00

I have built a USB data logger stick that shows up as a USB

  • 0

I have built a USB data logger stick that shows up as a USB mass storage device when plugged in for file download. The files are recorded offline, but the stick can return limited ‘live’ data (device clock, battery charge, instantaneous sensor value) when a small (<512 bytes, 1 disk sector) special file on the device is read – basically like a UNIX device file.

The application that reads and uses/displays the logger data is written in Python.

I thought I was a clever fellow, until I went to actually read live data from this file. It turns out that under Windows (tested in XP and Win7 so far), only the first read from the application actually reads from the device – attempting to re-read the file (sector) returs stale cached data from the initial read, even 10+ minutes after the initial read, even if the file is closed and re-opened, or if the sector is written to and then re-read. Nor does accessing the file data via mmap() cause fresh reads. The subsequent read requests simply don’t make it to the device at all. I guess Windows ‘knows’ it has not modified the file itself, so the file contents could not possibly have changed.

Is there any sane way to force a subsequent read (preferably via a ‘standard’ Python file I/O call) to actually return a fresh read from the device rather than cached data?

To be clear, I am specifically referring to thwarting a READ cache, not syncing the disk contents after a write.

Does anything like this exist that is accessible from within Python?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T19:58:48+00:00Added an answer on June 8, 2026 at 7:58 pm

    Invalidate OS disk read cache

    Using the win32 extensions for Python should allow you to access the CreateFile call directly to open the file. You may be able to use that to read your file.

    Here are the Win32 extensions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have developed a USB device that communicates with linux over a simple but
I have built so far an application that allows the user to drag and
I have built a game in HTML5 and a web form posts data to
I would like to get USB Mass Storage activity to turn on or off
I will build an C# WPF application that intakes USB/RS232 data (~ rate: 10ms)
I have a built in webcam (HP) and an USB webcam. Whenever I use
I have built a site which requires user to login. Now I have decided
I have built up an array of objects, created from a class, I wrote
I have built a local DVD Database using Codeigniter, With film names etc in.
I have built a Custom MaskedTextBox , changing the values of BeepOnError and AsciiOnly

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.