Manipulating devices

This is a discussion on Manipulating devices within the Networking/Device Communication forums, part of the General Programming Boards category; How is it possible to program a device, like a cd-rom drive, to do stuff? Ejecting for instance. Or how ...

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    3

    Smile Manipulating devices

    How is it possible to program a device, like a cd-rom drive, to do stuff?
    Ejecting for instance.
    Or how do i make a program that can manipulate my bluetooth device to send a file or some text to another computer?

    Are there special programming commands for every possible function for every piece of hardware?

    Hope somebody here knows!

    - Martin

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,987
    Moved: Device communication question.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    Each device has a specific set of commands that it can recognize. Most devices "live" at a specific address. In the case of a CDROM drive, the address is an extension of another device (eg, IDE channel, SCSI channel, USB, etc). In Linux (and other Unix like OSs) these devices are available to you in the form of a file. After opening one of these files, you can send an ioctl() command to that file and have it preform some type of action.

    A good place to start is the Linux Kernel. I'd only focus in on one type device (for starters) as it is not an easy task to learn how to manipulate devices directly.

    WARNING: DIRECTLY INTERFACING A DEVICE FROM CODE CAN CAUSE DAMAGE TO THE DEVICE, YOU MUST BE VERY CAREFUL WHEN ATTEMPTING TO WRITE A DEVICE DRIVER.

  4. #4
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,251
    Quote Originally Posted by Kennedy View Post
    WARNING: DIRECTLY INTERFACING A DEVICE FROM CODE CAN CAUSE DAMAGE TO THE DEVICE, YOU MUST BE VERY CAREFUL WHEN ATTEMPTING TO WRITE A DEVICE DRIVER.
    I killed a hard drive once while trying to write a TSR to park the disk head after a certain period of time. The code which determined the timeout was broken, so the result was the disk head parked and then unparked extremely rapidly. This causes the head to go SLAM SLAM SLAM SLAM against the parking region, eventually destroying it.

    This was a long time ago. Modern disk drives probably can't be forced to do something quite so destructive.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Accessing USB devices
    By deviousdexter in forum C# Programming
    Replies: 1
    Last Post: 01-24-2009, 08:48 PM
  2. Lost devices in Direct3D
    By VirtualAce in forum Game Programming
    Replies: 10
    Last Post: 12-09-2006, 06:41 AM
  3. Palm Pilot devices
    By ventolin in forum Networking/Device Communication
    Replies: 0
    Last Post: 03-11-2004, 09:51 AM
  4. Manipulating the Windows Clipboard
    By Johno in forum Windows Programming
    Replies: 2
    Last Post: 10-01-2002, 09:37 AM
  5. Manipulating Files
    By JoshuaNSW in forum C Programming
    Replies: 2
    Last Post: 01-24-2002, 01:01 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21