如何使用xxPL命令直接与通过macOS上的USB连接的打印机进行通讯?

问题描述

我有一台连接到Mac的特殊标签打印机(GoDEX RT863i)。它使用CUPS系统,并通过PPD文件进行配置。通常可以通过macOS打印系统进行打印。

现在,我需要通过xxPL(EZPL,GZPL,GEPL,Gdpl)通信接口向打印机发送一些特殊命令。

制造商提供了一个与打印机进行通讯的框架,但是它有很多错误,因此不适合使用(例如,我无法发送任意字节数据,因为该框架使用Nsstring而不是NSData,因此无法使用发送某些字节序列。

所以我想直接与打印机交谈。我该怎么办?

    @H_502_13@ CUPS是否提供让我向打印机发送命令的渠道? @H_502_13@我该如何处理打印机的USB端口? ioreg -r -c IoUSBHostDevice -l的印刷内容如下:
 +-o RT863i@00442000  <class IoUSBHostDevice,id 0x100126a4c,registered,matched,active,busy 0 (3 ms),retain 20>
   | {
   |   "sessionID" = 8582230593430921
   |   "USBSpeed" = 3
   |   "IOServiceLegacyMatchingRegistryID" = 4296174158
   |   "idProduct" = 1
   |   "IOReportLegendPublic" = Yes
   |   "IOPowerManagement" = {"PowerOverrideOn"=Yes,"CapabilityFlags"=32768,"MaxPowerState"=2,"DevicePowerState"=2,"ChildrenPowerState"=1,"DriverPowerState"=0,"CurrentPowerState"=2}
   |   "bcdDevice" = 1
   |   "bDeviceClass" = 0
   |   "USB Product Name" = "RT863i"
   |   "AppleUSBAlternateServiceRegistryID" = 4296174158
   |   "locationID" = 4464640
   |   "kUSBSerialNumberString" = "195003FF"
   |   "bDeviceSubClass" = 0
   |   "kUSBCurrentConfiguration" = 1
   |   "IOCFPlugInTypes" = {"9dc7b780-9ec0-11d4-a54f-000a27052861"="IoUSBFamily.kext/Contents/PlugIns/IoUSBLib.bundle"}
   |   "bDeviceProtocol" = 0
   |   "USBPortType" = 0
   |   "USB vendor Name" = "GODEX INTERNATIONAL CO."
   |   "idvendor" = 6495
   |   "USB Serial Number" = "195003FF"
   |   "IOGeneralInterest" = "IOCommand is not serializable"
   |   "IOReportLegend" = ({"IOReportGroupName"="Power","IOReportChannels"=((5795982523037122560,12886081538)),"IOReportChannelInfo"={"IOReportChannelUnit"=72058100844068865},"IOReportSubGroupName"="State"},{"IOReportGroupName"="Power","IOReportChannels"=((5288471043487301632,4296146945,"Consensus Idle Policy")),"IOReportChannelInfo"=$
   |   "kUSBvendorString" = "GODEX INTERNATIONAL CO."
   |   "IOClassNameOverride" = "IoUSBDevice"
   | }
   | 
   +-o AppleUSBHostLegacyClient  <class AppleUSBHostLegacyClient,id 0x100126a4f,!registered,!matched,busy 0,retain 9>
   |   {
   |     "kUSBHostDeviceForceSuspend" = No
   |     "IOPowerManagement" = {"DevicePowerState"=0,"CurrentPowerState"=1,"CapabilityFlags"=65536,"DriverPowerState"=1}
   |   }
   |   
   +-o AppleUSBHostCompositeDevice  <class AppleUSBHostCompositeDevice,id 0x100126a57,retain 4>
   |   {
   |     "IOProbescore" = 50000
   |     "CFBundleIdentifier" = "com.apple.driver.usb.AppleUSBHostCompositeDevice"
   |     "IOProviderClass" = "IoUSBHostDevice"
   |     "IOClass" = "AppleUSBHostCompositeDevice"
   |     "bDeviceSubClass" = 0
   |     "IOMatchCategory" = "IODefaultMatchCategory"
   |     "kUSBPreferredConfiguration" = 1
   |     "bDeviceClass" = 0
   |   }
   |   
   +-o Printer@0  <class IoUSBHostInterface,id 0x100126a58,busy 0 (1 ms),retain 6>
       {
         "USBPortType" = 0
         "IOCFPlugInTypes" = {"2d9786c6-9ef3-11d4-ad51-000a27052861"="IoUSBFamily.kext/Contents/PlugIns/IoUSBLib.bundle"}
         "bcdDevice" = 1
         "USBSpeed" = 3
         "idProduct" = 1
         "bConfigurationValue" = 1
         "bInterfaceSubClass" = 1
         "locationID" = 4464640
         "IOGeneralInterest" = "IOCommand is not serializable"
         "IOServiceLegacyMatchingRegistryID" = 4296174170
         "IOClassNameOverride" = "IoUSBInterface"
         "AppleUSBAlternateServiceRegistryID" = 4296174170
         "idvendor" = 6495
         "bInterfaceProtocol" = 2
         "bAlternateSetting" = 0
         "bInterfaceNumber" = 0
         "bInterfaceClass" = 7
       }

如您所见,它不会自动安装任何串行端口(到/dev/),因此我认为我需要使用其他方法,除非很容易创建与设备匹配的IOKit“驱动程序”并自动安装一个串行端口(不知道IOKit是否可以在没有任何额外代码的情况下完成此操作)?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)