fintrace / tspl2-driver

Java client to communicate to label printers that support TSPL2 (by TSC)
Apache License 2.0
77 stars 15 forks source link

USB Connection #32

Open mturhan11 opened 3 years ago

mturhan11 commented 3 years ago

When i want to connect USB device it says;

SWT SessionManagerDBus: Failed to connect to org.gnome.SessionManager: Ba\u011flant\u0131 kapal\u0131
SWT SessionManagerDBus: Failed to connect to org.xfce.SessionManager: Ba\u011flant\u0131 kapal\u0131
[main] INFO org.fintrace.core.drivers.tspl.connection.USBConnectionClient - USB Service Implementation: usb4java
[main] INFO org.fintrace.core.drivers.tspl.connection.USBConnectionClient - Implementation version: 1.2.0
[main] INFO org.fintrace.core.drivers.tspl.connection.USBConnectionClient - Service API version: 1.0.2
[main] INFO org.fintrace.core.drivers.tspl.connection.USBConnectionClient - Interface Direction: 0, Interface Address: 2
[main] INFO org.fintrace.core.drivers.tspl.connection.USBConnectionClient - Interface Direction: -128, Interface Address: -126

My Code is;

TSPLConnectionClient tsplConnectionClient = new USBConnectionClient((short)0x20d1,(short)0x7008 );
tsplConnectionClient.init();
tsplConnectionClient.connect();

My usb-devices list

T:  Bus=01 Lev=01 Prnt=01 Port=01 Cnt=02 Dev#=  2 Spd=12  MxCh= 0
D:  Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=20d1 ProdID=7008 Rev=01.00
S:  Manufacturer=HPRT
S:  Product=LPQ58
S:  SerialNumber=LPQ58017220173
C:  #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=10mA
I:  If#=0x0 Alt= 0 #EPs= 2 Cls=07(print) Sub=01 Prot=02 Driver=(none)

Please help. Thanks a lot.


mturhan11 commented 3 years ago

in a non root user

[main] INFO org.fintrace.core.drivers.tspl.connection.USBConnectionClient - USB Service Implementation: usb4java
[main] INFO org.fintrace.core.drivers.tspl.connection.USBConnectionClient - Implementation version: 1.2.0
[main] INFO org.fintrace.core.drivers.tspl.connection.USBConnectionClient - Service API version: 1.0.2
[main] ERROR org.fintrace.core.drivers.tspl.connection.USBConnectionClient - USB error 3: Can't open device Bus 001 Device 006: ID 20d1:7008: Access denied (insufficient permissions)
javax.usb.UsbPlatformException: USB error 3: Can't open device Bus 001 Device 006: ID 20d1:7008: Access denied (insufficient permissions)

in lsusb

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 8087:0a2b Intel Corp. 
Bus 001 Device 003: ID 046d:c534 Logitech, Inc. Unifying Receiver
Bus 001 Device 006: ID 20d1:7008  
Bus 001 Device 005: ID 1bcf:2b92 Sunplus Innovation Technology Inc. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub