473,378 Members | 1,577 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

USB Mass Storage

Hi,

I have a USB mass storage device being developed by
colleagues, and need to interface that to a Windows Forms
application (C#). The device is neither purely a storage
device nor an HID device, it is a combination of the two,
so it seems expedient to use files to communicate PC <->
Device.

The device can read AND WRITE files.

I can write and read the files, but they appear to be
cached ??. If the timestamp is changed by the device,
Windows does not see this change unless an 'Eject'
command is performed on the drive.

Have tried DirectoryInfo and FileInfo classes, as well as
a FileSystemWatcher (but I guess this uses the FileIO OS,
so won't see external changes). None of these can see the
new timestamp until the 'Eject' has been implemented.

How can I achieve this please - or how can I force the
cached file information to be refreshed, so that I can
see the change. Maybe do an 'Eject' programmatically ??? -
could be dangerous just to see a filestamp!!.

Thanks

Graham

Jul 21 '05 #1
5 2790
Its just a drive.
"Graham Stevenson" <an*******@discussions.microsoft.com> wrote in message
news:02****************************@phx.gbl...
Hi,

I have a USB mass storage device being developed by
colleagues, and need to interface that to a Windows Forms
application (C#). The device is neither purely a storage
device nor an HID device, it is a combination of the two,
so it seems expedient to use files to communicate PC <->
Device.

The device can read AND WRITE files.

I can write and read the files, but they appear to be
cached ??. If the timestamp is changed by the device,
Windows does not see this change unless an 'Eject'
command is performed on the drive.

Have tried DirectoryInfo and FileInfo classes, as well as
a FileSystemWatcher (but I guess this uses the FileIO OS,
so won't see external changes). None of these can see the
new timestamp until the 'Eject' has been implemented.

How can I achieve this please - or how can I force the
cached file information to be refreshed, so that I can
see the change. Maybe do an 'Eject' programmatically ??? -
could be dangerous just to see a filestamp!!.

Thanks

Graham

Jul 21 '05 #2
Thanks for the comment, but if its 'Just a Drive' - why
doesn't it update its timestamp, when the device changes
it ?? - until I select 'Eject' for the drive.

Device has a file with given timestamp.
Read this in a .Net app = fine.
Device changes the timestamp.
Read in .Net and it has not changed.
Eject.
Read in .Net and it now has changed.

The point being that the device itself can change the
file parameters - all I want to do is to force Windows to
recognise that change, so that I can monitor it.

Thanks

Graham
-----Original Message-----
Its just a drive.
"Graham Stevenson" <an*******@discussions.microsoft.com> wrote in messagenews:02****************************@phx.gbl...
Hi,

I have a USB mass storage device being developed by
colleagues, and need to interface that to a Windows Forms application (C#). The device is neither purely a storage device nor an HID device, it is a combination of the two, so it seems expedient to use files to communicate PC <-

Device.

The device can read AND WRITE files.

I can write and read the files, but they appear to be
cached ??. If the timestamp is changed by the device,
Windows does not see this change unless an 'Eject'
command is performed on the drive.

Have tried DirectoryInfo and FileInfo classes, as well as a FileSystemWatcher (but I guess this uses the FileIO OS, so won't see external changes). None of these can see the new timestamp until the 'Eject' has been implemented.

How can I achieve this please - or how can I force the
cached file information to be refreshed, so that I can
see the change. Maybe do an 'Eject' programmatically ??? - could be dangerous just to see a filestamp!!.

Thanks

Graham

.

Jul 21 '05 #3
You need to use AutoFlush or call .Flush() i guess as its not written
immediatlly its buffered, right?
"Graham Stevenson" <an*******@discussions.microsoft.com> wrote in message
news:08****************************@phx.gbl...
Thanks for the comment, but if its 'Just a Drive' - why
doesn't it update its timestamp, when the device changes
it ?? - until I select 'Eject' for the drive.

Device has a file with given timestamp.
Read this in a .Net app = fine.
Device changes the timestamp.
Read in .Net and it has not changed.
Eject.
Read in .Net and it now has changed.

The point being that the device itself can change the
file parameters - all I want to do is to force Windows to
recognise that change, so that I can monitor it.

Thanks

Graham
-----Original Message-----
Its just a drive.
"Graham Stevenson" <an*******@discussions.microsoft.com>

wrote in message
news:02****************************@phx.gbl...
Hi,

I have a USB mass storage device being developed by
colleagues, and need to interface that to a Windows Forms application (C#). The device is neither purely a storage device nor an HID device, it is a combination of the two, so it seems expedient to use files to communicate PC <-

Device.

The device can read AND WRITE files.

I can write and read the files, but they appear to be
cached ??. If the timestamp is changed by the device,
Windows does not see this change unless an 'Eject'
command is performed on the drive.

Have tried DirectoryInfo and FileInfo classes, as well as a FileSystemWatcher (but I guess this uses the FileIO OS, so won't see external changes). None of these can see the new timestamp until the 'Eject' has been implemented.

How can I achieve this please - or how can I force the
cached file information to be refreshed, so that I can
see the change. Maybe do an 'Eject' programmatically ??? - could be dangerous just to see a filestamp!!.

Thanks

Graham

.

Jul 21 '05 #4
I (or my PC app) are not writing to the file, so I don't
have anything to Flush.

The USB device is a two-way device, which is capable of
changing a file, hence why the device (not Windows)
changes the timestamp, and I am trying to get Windows
to 'see' this change - without the need for an 'Eject' -
or even with an 'Eject' if I can issue this from my
Windows app - but I don't know how to without the need
for a new device driver.

It must be possible for a windows app to send an 'Eject'
command - as Windows Explorer can do it, but I can't find
how to having trawled MSDN, Web etc.

Graham
-----Original Message-----
You need to use AutoFlush or call .Flush() i guess as its not writtenimmediatlly its buffered, right?
"Graham Stevenson" <an*******@discussions.microsoft.com> wrote in messagenews:08****************************@phx.gbl...
Thanks for the comment, but if its 'Just a Drive' - why
doesn't it update its timestamp, when the device changes it ?? - until I select 'Eject' for the drive.

Device has a file with given timestamp.
Read this in a .Net app = fine.
Device changes the timestamp.
Read in .Net and it has not changed.
Eject.
Read in .Net and it now has changed.

The point being that the device itself can change the
file parameters - all I want to do is to force Windows to recognise that change, so that I can monitor it.

Thanks

Graham
>-----Original Message-----
>Its just a drive.
>
>
>"Graham Stevenson" <an*******@discussions.microsoft.com>
wrote in message
>news:02****************************@phx.gbl...
>> Hi,
>>
>> I have a USB mass storage device being developed by
>> colleagues, and need to interface that to a Windows

Forms
>> application (C#). The device is neither purely a

storage
>> device nor an HID device, it is a combination of the

two,
>> so it seems expedient to use files to communicate
PC <- >
>> Device.
>>
>> The device can read AND WRITE files.
>>
>> I can write and read the files, but they appear to be >> cached ??. If the timestamp is changed by the device, >> Windows does not see this change unless an 'Eject'
>> command is performed on the drive.
>>
>> Have tried DirectoryInfo and FileInfo classes, as well as
>> a FileSystemWatcher (but I guess this uses the
FileIO OS,
>> so won't see external changes). None of these can
see the
>> new timestamp until the 'Eject' has been

implemented. >>
>> How can I achieve this please - or how can I force the >> cached file information to be refreshed, so that I can >> see the change. Maybe do an 'Eject'

programmatically ??? -
>> could be dangerous just to see a filestamp!!.
>>
>> Thanks
>>
>> Graham
>>
>
>
>.
>

.

Jul 21 '05 #5
Cant you use the File system watcher like a normal file? Then you can get
notified once its changed?


<an*******@discussions.microsoft.com> wrote in message
news:0a****************************@phx.gbl...
I (or my PC app) are not writing to the file, so I don't
have anything to Flush.

The USB device is a two-way device, which is capable of
changing a file, hence why the device (not Windows)
changes the timestamp, and I am trying to get Windows
to 'see' this change - without the need for an 'Eject' -
or even with an 'Eject' if I can issue this from my
Windows app - but I don't know how to without the need
for a new device driver.

It must be possible for a windows app to send an 'Eject'
command - as Windows Explorer can do it, but I can't find
how to having trawled MSDN, Web etc.

Graham
-----Original Message-----
You need to use AutoFlush or call .Flush() i guess as

its not written
immediatlly its buffered, right?
"Graham Stevenson" <an*******@discussions.microsoft.com>

wrote in message
news:08****************************@phx.gbl...
Thanks for the comment, but if its 'Just a Drive' - why
doesn't it update its timestamp, when the device changes it ?? - until I select 'Eject' for the drive.

Device has a file with given timestamp.
Read this in a .Net app = fine.
Device changes the timestamp.
Read in .Net and it has not changed.
Eject.
Read in .Net and it now has changed.

The point being that the device itself can change the
file parameters - all I want to do is to force Windows to recognise that change, so that I can monitor it.

Thanks

Graham

>-----Original Message-----
>Its just a drive.
>
>
>"Graham Stevenson" <an*******@discussions.microsoft.com> wrote in message
>news:02****************************@phx.gbl...
>> Hi,
>>
>> I have a USB mass storage device being developed by
>> colleagues, and need to interface that to a Windows
Forms
>> application (C#). The device is neither purely a
storage
>> device nor an HID device, it is a combination of the
two,
>> so it seems expedient to use files to communicate PC <- >
>> Device.
>>
>> The device can read AND WRITE files.
>>
>> I can write and read the files, but they appear to be >> cached ??. If the timestamp is changed by the device, >> Windows does not see this change unless an 'Eject'
>> command is performed on the drive.
>>
>> Have tried DirectoryInfo and FileInfo classes, as well as
>> a FileSystemWatcher (but I guess this uses the FileIO OS,
>> so won't see external changes). None of these can see the
>> new timestamp until the 'Eject' has been implemented. >>
>> How can I achieve this please - or how can I force the >> cached file information to be refreshed, so that I can >> see the change. Maybe do an 'Eject'
programmatically ??? -
>> could be dangerous just to see a filestamp!!.
>>
>> Thanks
>>
>> Graham
>>
>
>
>.
>

.

Jul 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Jeffrey Silverman | last post by:
Hi, all. Sorry, first off, for the kidna weird selection of crossposted groups, but this question touches on aspects of discussion in each of the groups. So I have a group of around 500 email...
1
by: John Rauhe | last post by:
Hello, Does anybody know how to detect if an mass-storage device has been added to the system ? I am making a program that will (should) detect when a CompactFlash memory card has been inserted...
0
by: Ivan | last post by:
Hi, all, How to get BusRelations of a USB Mass Storage Device in C#? Or, do we have any function to get BusRelations of a USB Mass Storage Device, even not in C#? Any information is...
3
by: Gil \(Asp.net Developer\) | last post by:
5
by: Graham Stevenson | last post by:
Hi, I have a USB mass storage device being developed by colleagues, and need to interface that to a Windows Forms application (C#). The device is neither purely a storage device nor an HID...
3
by: cordial_camaraderie | last post by:
I need to send 30,000 emails to our NewsLetter Subscriber, I tried to use our hosting Site and for the worst part We we banned and our site was stopped. I am using PHP script, mail() function to...
0
by: anupamak | last post by:
Hello I am working on USB Project, I am searching for any of the API's method in windows , so that my application can sense that a file in the PC is being copied or moved onto the USB mass storage...
1
by: prasobh | last post by:
How can read data from a USB mass storage device (which is detected by OS windows XP)with C or how can i find the address of the particular device.Is there any way to address individual memory...
6
by: 23054467 | last post by:
I want to play media files stored on my computer on my TV, but I don't want to use the built-in TV-out card. Instead I want to use my stand alone DVD-player, which supports playing media files from a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.