Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Monitoring USB for a print command  (Read 1387 times)

0 Members and 1 Guest are viewing this topic.

processedmeat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 253
  • Last login:July 08, 2025, 12:30:14 pm
  • Ikeakade Here I come!
Monitoring USB for a print command
« on: June 26, 2015, 04:42:56 pm »
Not sure where to put this and mods feel free to delete or move this but since this site is full of absolutely brilliant maker type of people I thought I would ask.

While taking a hiatus from my arcade cabinet, I put together a photobooth for my nonprofit for use at their fundraising galas.  When somebody takes a photo it will print to either one of the two Canon Selphy printers located in two separate bays of the photobooth.  I use the printer spooling feature in Windows so that when one is occupied, it will print to the other.

Is there a way to monitor the USB for the print command and then output a command to turn on the leds of that bay so that the user knows which bay where their photo is coming out of?  Or is there another way to do this?

Thanks for reading this.

behrmr

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 459
  • Last login:April 23, 2021, 09:17:13 am
Re: Monitoring USB for a print command
« Reply #1 on: June 26, 2015, 11:07:12 pm »
I would suggest rather than monitoring the USB port you would look to monitor the print queue activity.  I would imagine a scripting language would be able to do this pretty easily.

SavannahLion

  • Wiki Contributor
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5986
  • Last login:December 19, 2015, 02:28:15 am
Re: Monitoring USB for a print command
« Reply #2 on: June 28, 2015, 02:49:27 am »
I would suggest rather than monitoring the USB port you would look to monitor the print queue activity.  I would imagine a scripting language would be able to do this pretty easily.

Be careful with this, some printers will "lie". We have something along the lines of twenty different printers from nearly every manufacturer at my work and they all have their "personalities". Some of the quirkiest I've ever seen. The queue on some behave correctly so you always know when they're available, others will flush the queue as soon as the print job starts (even if it's a 100 pages).

One of my damn scripts at work broke because a new printer we bought always reports a paper jam even though there's no paper jam at all. Took me weeks to figure out why the script would only work for some people. :badmood:

If you have control over the software, why not alternate between printer 1 and 2 during prints? If you send the job to printer 1, the light up #1. if you send the job to #2 light up #2.

processedmeat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 253
  • Last login:July 08, 2025, 12:30:14 pm
  • Ikeakade Here I come!
Re: Monitoring USB for a print command
« Reply #3 on: June 29, 2015, 01:07:44 pm »

If you have control over the software, why not alternate between printer 1 and 2 during prints? If you send the job to printer 1, the light up #1. if you send the job to #2 light up #2.

That is what I want to be able to do.  Any ideas how to make this happen?

SavannahLion

  • Wiki Contributor
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5986
  • Last login:December 19, 2015, 02:28:15 am
Re: Monitoring USB for a print command
« Reply #4 on: June 29, 2015, 06:13:20 pm »
IIRC the Windows API EnumPrinter allows you to enumerate the available printers installed. Once you have that info, build a Round Robin array and send the print jobs to right printer as you go down the list. Check out the MSDN reference for the API https://msdn.microsoft.com/en-us/library/windows/desktop/dd162863(v=vs.85).aspx

Illuminating LEDs is a bit different as you'll likely be relying on an external IO board for that. What did you have in mind for that?

processedmeat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 253
  • Last login:July 08, 2025, 12:30:14 pm
  • Ikeakade Here I come!
Re: Monitoring USB for a print command
« Reply #5 on: July 01, 2015, 02:29:34 pm »
I have a bunch of these usb led indicator lights that are controllable using a command line argument.  I figure I can extend them by adding a few more leds in parallel to make the bay brighter. 

I just have to go from Windows knowing where the print is heading to and using a script to turn on the indicator lights.


Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Today at 02:45:49 am
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Monitoring USB for a print command
« Reply #6 on: July 01, 2015, 03:20:25 pm »
I'm kind of confused as to your problem... if you wrote a program don't you know which printer you sent the print command to?  If not perhaps you should instead be researching how to print to a specific device in whatever language you wrote it in.