943,973 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 7820
  • PHP RSS
Mar 9th, 2005
0

USB device command

Expand Post »
Hello,

I would like to send a specific string of commands to a USB device connected to my computer. Is there a PHP function that allows this?

Thanks,

Choky
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
choky is offline Offline
3 posts
since Mar 2005
Mar 9th, 2005
0

Re: USB device command

Serial communication has to be done fairly low level using Windows API's.

You can buy a wrapper component called ActiveComport (USB is just a much much faster RS232) here which gives you an interface you can manipulate in scripting languages.

I beleive on Linux it's simpler because everythings a file, so you just read and write your bits to the file that represents your USB port or device, if I find any leads in that direction I'll post them.
Reputation Points: 262
Solved Threads: 68
Veteran Poster
hollystyles is offline Offline
1,181 posts
since Feb 2005
Mar 9th, 2005
0

Re: USB device command

Thanks! But if it is possible to access USB devices then any webpage can just control your peripherals and cause a mess, no?
Secondly, can PHP give orders to ActiveComport? and if so, what functions can be used? I would like to use PHP for a new POS (point of sale) software I am developing for my shop. The problem is sending orders to the cash drawer/printer using php.


Quote originally posted by hollystyles ...
Serial communication has to be done fairly low level using Windows API's.

You can buy a wrapper component called ActiveComport (USB is just a much much faster RS232) here which gives you an interface you can manipulate in scripting languages.

I beleive on Linux it's simpler because everythings a file, so you just read and write your bits to the file that represents your USB port or device, if I find any leads in that direction I'll post them.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
choky is offline Offline
3 posts
since Mar 2005
Mar 9th, 2005
0

Re: USB device command

Any webpage cannot control your USB port, PHP is not just for web pages although that's where it is most commonly used. ActiveComport is a component that you will have to register with the windows registry on the machine on which you are executing your PHP script. I'm afraid I am not an authority on PHP as I have used it very little, and the site I gave does not mention PHP specifically. But if VBScript can use it I would be very surprised if PHP couldn't.
Reputation Points: 262
Solved Threads: 68
Veteran Poster
hollystyles is offline Offline
1,181 posts
since Feb 2005
Mar 9th, 2005
0

Re: USB device command

I think this might help: PHP: Direct IO Functions

Dance
Reputation Points: 17
Solved Threads: 14
Posting Whiz
DanceInstructor is offline Offline
355 posts
since Feb 2005
Mar 10th, 2005
0

Re: USB device command

Ooh nice, I could find some uses for that, thinking send/receive SMS text messages thru PDA phone.

Choky,
I take it your cash drawer has a USB interface, does it not have any software with it, perhaps the vendor or manufacturer have a development KIT ?
Reputation Points: 262
Solved Threads: 68
Veteran Poster
hollystyles is offline Offline
1,181 posts
since Feb 2005
Mar 10th, 2005
0

Re: USB device command

This is the printer I will use: http://www.orient-technologies.com/p...BTP-2002CP.pdf .
The cash drawer connects directly to the printer so when it gets a command to print, it tells the drawer to open. So really what I need is just communication with the printer.



Quote originally posted by hollystyles ...
Ooh nice, I could find some uses for that, thinking send/receive SMS text messages thru PDA phone.

Choky,
I take it your cash drawer has a USB interface, does it not have any software with it, perhaps the vendor or manufacturer have a development KIT ?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
choky is offline Offline
3 posts
since Mar 2005
Mar 10th, 2005
0

Re: USB device command

Sorry, I'm really lost here.

Why do you want to mess about with low level stuff like communicating with a printer?

I take it this PHP POS software is going to run on a pc, on which the printer is installed as a device right?

so you just want to create a receipt document from your sales data and just put it in the print queue right ? let your OS worry about talking to the printer.
Reputation Points: 262
Solved Threads: 68
Veteran Poster
hollystyles is offline Offline
1,181 posts
since Feb 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Php / Rtf
Next Thread in PHP Forum Timeline: php mysql help





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC