SNMP的本地打印机? [英] SNMP for Local printer?

查看:630
本文介绍了SNMP的本地打印机?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种方式来获得从本地打印机信息。也许SNMP协议?

I am searching for a way to Get Information from a local printer. Maybe with the SNMP Protocol?

打印机用USB或PPI(并行端口)连接。所有的打印机都有一个内部TotalPagesCount和支持SNMP

The printer is connected with USB or PPI (parallel port). All printers have a internal TotalPagesCount and support SNMP.

下面的打印机的一些例子:

Here some examples of the Printers:


  • 兄弟HL1430

  • 兄弟HL5150

  • 兄弟HL1230

  • 京瓷1118

  • 京瓷1128

  • 京瓷2000

  • 京瓷1300

  • 京瓷3920

  • 京瓷1920

  • 京瓷1350

  • Brother HL1430
  • Brother HL5150
  • Brother HL1230
  • Kyocera 1118
  • Kyocera 1128
  • Kyocera 2000
  • Kyocera 1300
  • Kyocera 3920
  • Kyocera 1920
  • Kyocera 1350

这可能吗?谢谢

推荐答案

我觉得SNMP是正确的做法。大多数打印机落实标准打印机MIB 和的RFC 1213 MIB ,以便从那里将是独立的模型,你可以得到任何财产。举例来说,如果你找的序列号你的财产可能是prtGeneralSerialNumber 1.3.6.1.2.1.43.5.1.1.17

I think SNMP is the correct approach. Most printers implement the standard printer MIB and the RFC 1213 MIB so any property you can get from there is going to be model independent. For instance, if you look for the serial number your property is probably prtGeneralSerialNumber 1.3.6.1.2.1.43.5.1.1.17

有关其他属性你将需要搜索在特定的MIB,例如在 HP LASERJET MIB 你有一个很多喜欢的印刷媒体的使用,印刷媒体单数,印刷媒体双工数,使用量平均调色剂覆盖,扫描,媒体使用情况,总彩页计数的东西.....

For other properties you are going to need to search in the specific MIBs, for instance in the HP Laserjet MIB you have a lot of stuff like printed-media-usage, printed-media-simplex-count, printed-media-duplex-count, usage-average-toner-coverage, scanned-media-usage, total-color-page-count.....

要使用SNMP最扩展库的的Net-SNMP ,但它采用的是C API,如果你需要在重多线程应用程序或使用SNMPv3的使用它,我不建议这样做。还有其他的库如链接文本,看起来非常有前途,但大部分可靠的库在那里的商业和不是很便宜。

To use SNMP the most extended library is Net-SNMP but it uses a C API and I don't recommend it if you need to use it in heavy multithreaded applications or using SNMPv3. There are other libraries like link text that look very promising, but most of the reliable libraries out there commercial and not very cheap.

以上全部是很容易>你需要让你的手到实施如果打印机连接网络,现在如果打印机USB或PPI连接一个伟大的职位
它说,基本上它是的一点点Windows的软件,在标准Windows SNMP服务,小猪背上,还可通过USB或并口电缆的连接到计算机的默认HP打印机上的SNMP数据。我不知道这是否与任何其他品牌的作品,但它看起来像它采用标准的协议,DOT4通过USB来模拟典型的TCP / IP通信。如果有连接到所有这些打印机的标准方法这个人是最有前途的。
,我能想到的另一个方法是破解每个模型的个体司机,看看他们是否提供这样的信息(这肯定做),使各自的调用他们得到它,但这个任务,我认为你是你自己的。

All the above is quite easy to implement if the printer is network connected, now if the printer is USB or PPI connected you need to get your hands into the HP SNMP Proxy Agent, you can find a great post here. It says that basically it is a little Windows software that piggy-backs on the standard Windows SNMP service and provides SNMP data on the default HP printer connected to a computer via USB or parallel cable. I don't know if it works with any other brands but it looks like it uses the standard protocol DOT4 over USB to emulate typical TCP/IP communications. If there is any standard method to connect to all those printers this one is the most promising. Another method that I can think of is to hack the individual drivers of each model to see if they provide such information (which most certainly do) and make the respective calls to them to get it, but on this task I think that you are on your own.

修改

通过驱动破解我的意思逆向工程每个驱动程序的可能的工具。例如,如果打印机有一个工具,能够显示墨粉状态试着去了解它是如何工作的,我将开始使用取决于打开可执行文件,看哪些DLL它正在使用,他们发表什么方法,如果你发现像GetTonerStatus的方法在DLL这是值得尝试使用它。

With driver hacking I mean reverse engineering probably the tools of each driver. For example, if a printer has a utility that shows the toner status try to understand how it works, I would start using Depends to open the executable and see which dlls it is using and what methods they publish, if you find a method like GetTonerStatus in the dll it is worth to try to use it.

如果该工具是用.NET编写更容易因为哟可以访问通过反编译它的源代码(我不知道这种方法的法律问题)。使用反射做到这一点,你会清楚地看到它。

If the tool is written in .Net it much easier because yo can have access to the source code by decompiling it (I don't know about legal issues of this method). Use reflector to do it and you will see it clearly.

有是覆盖此方面称为倒车一个伟大的书:逆向工程的秘密

There is a great book that covers this aspects called Reversing: Secrets of Reverse Engineering

由于之前说这是一个漫长的道路,但可能是唯一一个实现你想要做什么,你可能要调查了一下我所提到的话题后重新考虑项目的可行性。

As said before this is a long path but probably the only one to achieve what you want to do, you might want to reconsider the viability of project after investigating a bit the topics I mentioned.

这篇关于SNMP的本地打印机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆