473,667 Members | 2,548 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to control a USB DISK?

hello all,
I now have a simple project. It is to test the change of use disk,
when a new usb disk is plugged into the usb socket, the program will
copy a file to the usb disk, then disabled the usb disk to be pulled
out safely. I intend to make it with python. Does someone here get any
experiences about USB disk programming, and any suggestons ?
Thanks a lot.

Jul 18 '05 #1
3 2061
zy*****@163.net wrote:
hello all,
I now have a simple project. It is to test the change of use disk,
when a new usb disk is plugged into the usb socket, the program will
copy a file to the usb disk, then disabled the usb disk to be pulled
out safely. I intend to make it with python. Does someone here get any
experiences about USB disk programming, and any suggestons ?
Thanks a lot.

if you are using windows:

Perhaps you can use COM to detect the evenet of the disk beeing placed
in it's socket (i don't know if it's possible) and then jost copy the
file. I gues that the real problem are the detecting of the session
start and beeing able to disable the disk. I don't know which (if any)
COM service that can be used.

ola

--
--------------------------------------
Ola Natvig <ol********@inf osense.no>
infoSense AS / development
Jul 18 '05 #2
Hi,

when you're under linux and a 2.6er kernel, take a look at hotplug, you
can configure it the way that your script gets executed whenever a
specific device is plugged in/out ...

HtH, Roland

zy*****@163.net wrote:
when a new usb disk is plugged into the usb socket, the program will
copy a file to the usb disk, then disabled the usb disk to be pulled
out safely.


Jul 18 '05 #3
I actually tried this last summer on linux and I think in order to
make it work right I had to use the hotplug features AND udev. I had
to use udev because I needed a specific mount path, otherwise it just
picked the next in the list if there was more than one drive.

I ended up skipping that project because it was a pain and I just
didnt have enough time. Allthough, I could write to usb drives.

Look into hotplug and udev, hopefully that gets you going.
On Wed, 02 Mar 2005 14:56:05 +0100, Roland Heiber <ro***********@ web.de> wrote:
Hi,

when you're under linux and a 2.6er kernel, take a look at hotplug, you
can configure it the way that your script gets executed whenever a
specific device is plugged in/out ...

HtH, Roland

zy*****@163.net wrote:
when a new usb disk is plugged into the usb socket, the program will
copy a file to the usb disk, then disabled the usb disk to be pulled
out safely.


--
http://mail.python.org/mailman/listinfo/python-list

Jul 18 '05 #4

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

Similar topics

6
2468
by: Nathan Griffiths | last post by:
I have been testing our SQL Mail setup in SQL Server 2000 (sp3a) and have found that when I attach results as a file, every other character is a control character which causes each real character output on a separate line. I have no idea why this is happenening, I've never seen it before. The code looks like this; EXEC master.dbo.xp_sendmail @recipients = '<email address>', @dbuse = 'TestDB',
0
1729
by: idesilva | last post by:
Hi, I have an app that generates a text log at a very high rate. Currently I use an ofstream object to write the log. I would like to control when 'exactly' the log is written to the disk. Also I want to be able to reset the buffer contents without writing them to the disk file. - Can the 'buffer size' of an ofstream object (in fact, any iostream lib object) be controlled? - Can we control *when* the buffer is flushed?
7
2478
by: John | last post by:
Hi, Is there any control (free) that has same functionality as IE to display the XML document without having to create a physical file? if using Webbrowser control (ActiveX control) I have to create a xml file and then use .Navigate(url) ... Thanks!
3
18457
by: Steve Montague | last post by:
I need to decode a base64 image and display it in a PictureBox control. Currently I get an "Invaild character in a Base-64 string." error, so not sure if a bad file or bad code, I have: byte arrBytes = new Byte; // read the file from disk System.IO.FileStream fs = System.IO.File.OpenRead("../../Photo.jpg"); arrBytes = new byte; fs.Read(arrBytes, 0, (int)fs.Length - 1);
2
1496
by: Denise Smith | last post by:
Hello, I'm wondering if anyone can help me out here? I want to be able to browse records in a database where one of the fields contains an image. I think I might have to extract the image to a byte array, write it to a temp file then refer to the temp file as the URL source for the Image control.
5
15810
by: David Elliott | last post by:
I need a control on a Web Page that can accept an HTML Document and will display it. Any help would be appreciated. Thanks, Dave Here is what I was trying...
14
9903
by: GSSI | last post by:
I have an image data field in a datarow (as in the Northwinds demo sql database). What is the C# instruction syntax to display it in a Winform picturebox control. -- GSSI
11
8704
by: Webbert | last post by:
I am trying to display XML in a WebBrowser Control. I receive a data feed of XML and am trying to inject it into the control. I have not been successful in doing so. The only solution I have found is to write it to a temp file and then use the Navigate method to load it. As the control is capable of loading it from disk, I would like to find a way to skip the save/load and just inject. Thanks, Dave
6
7543
by: titan.nyquist | last post by:
The WebBrowser control won't load a css file written in the same directory as the program. If I put an absolute path to it, it will load it. Thus, the current directory of the WebBrowser control isn't the current directory of the program. What is the current directory? I don't want to use an absolute path, since its contents are saved to disk, and that should always load the css file no matter where it and the css file exists. Titan
0
8454
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8363
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8883
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8787
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8561
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7389
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2776
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.