Hi,
W dniu 18.02.2014 10:36, Johan Hovold pisze:
On Sun, Feb 16, 2014 at 12:35:06PM +0100, Emanuel Koczwara wrote:
Hi,
I have a device (thermal printer) which communicates through rs232. It
has also usb adapter/converter build-in.
root@emanuel-laptop:/home/emanuel# lsusb
Bus 004 Device 004: ID 8086:0189 Intel Corp.
Bus 004 Device 008: ID 1a28:6010 <-- here
Who is the manufacturer and what is the model?
http://www.novitus.pl/pl/produkty/systemy-fiskalne/bono-e.html
It is a fiscal printer used in Poland produced by NOVITUS. I have BONO E
1.10.
Bus 004 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 003: ID 0458:003a KYE Systems Corp. (Mouse Systems)
NetScroll+ Mini Traveler / Genius NetScroll 120
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 004: ID 05ca:181f Ricoh Co., Ltd
Bus 001 Device 003: ID 138a:0011 Validity Sensors, Inc. VFS5011
Fingerprint Reader
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
root@emanuel-laptop:/home/emanuel# lsusb -d 1a28:6010 -v
Bus 004 Device 008: ID 1a28:6010
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x1a28
idProduct 0x6010
bcdDevice 5.00
iManufacturer 4 (error)
iProduct 14 (error)
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 55
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 90mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 255 Vendor Specific Subclass
bInterfaceProtocol 255 Vendor Specific Protocol
iInterface 14 (error)
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 255 Vendor Specific Subclass
bInterfaceProtocol 255 Vendor Specific Protocol
iInterface 14 (error)
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x04 EP 4 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Device Status: 0x0001
Self Powered
After 'modprobe usbserial vendor=0x1a28 product=0x6010' the device is
working, /dev/ttyUSB0 pops out. I can read and write to /dev/ttyUSB0 and
it responds.
[34449.932999] usb 4-1.3: new full-speed USB device number 8 using ehci-pci
[34450.029508] usb 4-1.3: string descriptor 0 read error: -32
[34450.029521] usb 4-1.3: New USB device found, idVendor=1a28,
idProduct=6010
[34450.029526] usb 4-1.3: New USB device strings: Mfr=4, Product=14,
SerialNumber=0
[34450.029927] usbserial_generic 4-1.3:1.0: The "generic" usb-serial
driver is only for testing and one-off prototypes.
[34450.029932] usbserial_generic 4-1.3:1.0: Tell
linux-usb@vger.kernel.orgto add your device to a proper driver.
[34450.029936] usbserial_generic 4-1.3:1.0: generic converter detected
[34450.030331] usb 4-1.3: generic converter now attached to ttyUSB0
[34450.030410] usbserial_generic 4-1.3:1.1: The "generic" usb-serial
driver is only for testing and one-off prototypes.
[34450.030413] usbserial_generic 4-1.3:1.1: Tell
linux-usb@vger.kernel.orgto add your device to a proper driver.
[34450.030415] usbserial_generic 4-1.3:1.1: generic converter detected
[34450.030525] usb 4-1.3: generic converter now attached to ttyUSB1
Do you know what the second interface (/dev/ttyUSB1) is for?
Yes. This device has 2 serial ports (RS232) and these 2 ports are
available through rs232/usb adapter/converter, so I have /dev/ttyUSB0
and /dev/ttyUSB1. Second port offers additional functionalities.
Above output from dmesg suggests, that I should report it on this
mailing list. I am using debian jessie/sid with 3.12-1-686-pae kernel.
Yes, we could add an entry with the vid/pid to the usb-serial-simple
driver so the device will just work without having to supply any
modprobe parameters.
Would be great.
I have just one problem with that device. This is typical response from
the printer:
1#X0;0;0;1;1;1;14;02;05/23.00/08.00/00.00/05.00/17/0.00/0.001`/0.00/0.00/0.00/284.00/BCM11034990
and this "1`" inside is strange, so I investigated further:
emanuel@emanuel-laptop:~$ cat /dev/ttyUSB0
1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`1`^C
What can I do with that? Is it becouse the generic driver?
Not likely. What happens if you open the device using a terminal program
such as minicom?
Using minicom I get the same constant stream of data.
I'm using c++ and boost::asio. I am sure, that my settings are correct:
io = new io_service();
port = new serial_port(*io, device);
port->set_option<>(serial_port::baud_rate(9600));
port->set_option<>(serial_port::parity(serial_port::parity::none));
port->set_option<>(serial_port::stop_bits(serial_port::stop_bits::one));
port->set_option<>(serial_port::flow_control(serial_port::flow_control::none));
port->set_option<>(serial_port::character_size(8));
My read function looks like this:
char c = 0;
string result = "";
while (true)
{
boost::asio::read(*port, boost::asio::buffer(&c, 1));
result.append(lexical_cast<string>(c));
if (result.size() >=2)
{
if (c == '\\' && result[result.size() - 2] == (char)0x1b)
{
break;
}
}
}
size_t pos = result.find("\x1bP");
if (pos != string::npos)
{
result = result.substr(pos + 2);
}
And after that I'm using a small hack to remove this garbage:
result = boost::regex_replace(result, boost::regex("1`"), "");
Thanks,
Emanuel
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html