in reply to USB interface

You don't need to know anything at the USB level. The OS isolates you from all of that and treats the device as it does any other mass storage device that is part of the file system. Just use usual File I/O to get the work done.


True laziness is hard work

Replies are listed 'Best First'.
Re^2: USB interface
by Anonymous Monk on Jun 15, 2009 at 04:56 UTC

    I think I've miscommunicated. Here is my requirement

    When the user plugs-in the USB device, my program has to ask for password from the user. Once authentication is right, the user will be prompted to enter the file name, that he needs to transfer from system to USB.

    The primary purpose is that, the user should not use any other method to copy the files other than this interface, and the files copied by using this interface will be reported to the administrator. This interface is mainly used to log the files that are transfered.

    Please suggest how can I do this?

      If the OS doesn't provide an 'out of the box' way to manage user permissions for that sort of access then you have a great deal of work ahead of you! On Windows most likely you would need to write your own filter driver and insert it into the driver stack for USB mass storage devices, but that would be more work than you want to think about and is not something you can do in Perl. I've no idea what is required in a *nix context, but I suspect Perl won't get you there in that context either.


      True laziness is hard work

      When the user plugs-in the USB device, my program has to ask for password from the user.

      So you want to change the behaviour of the OS, and you didn't mention which OS. I'm not sure what any of this has to do with Perl. Find out what you need to do, and we'll help you implement it in Perl if you have trouble.

      Sounds like you didn't do any thinking or research at all.

        I'm on linux. What I felt is, when the user plugs in USB device, I think it will be automatically mounted somewhere right?

        If so, I will watch that and I'll execute my script to ask password