Skip to content

Commit 4e21fb7

Browse files
committed
modify readme
1 parent 4229f50 commit 4e21fb7

File tree

5 files changed

+15
-20
lines changed

5 files changed

+15
-20
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,18 @@ Raises `CashDrawerError()``
157157

158158
----
159159

160+
## Screencast
161+
162+
![IMG_1031.JPG](./screencasts/IMG_1031.JPG)
163+
164+
----
165+
160166
## Thanks
161167

162168
+ Part of code from [@taoyuan](https://github.com/taoyuan)
169+
+ [Jose Vera](https://github.com/jor3l)
170+
+ [Sébastien Vidal](https://github.com/Psychopoulet)
171+
+ [Yu Yongwoo](https://github.com/uyu423)
163172

164173
----
165174

adapter/usb.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -76,32 +76,22 @@ util.inherits(USB, EventEmitter);
7676
* @return {[type]} [description]
7777
*/
7878
USB.prototype.open = function (callback){
79-
8079
let self = this, counter = 0, index = 0;
8180
this.device.open();
82-
8381
this.device.interfaces.forEach(function(iface){
84-
8582
(function(iface){
86-
8783
iface.setAltSetting(iface.altSetting, function(){
88-
8984
// http://libusb.sourceforge.net/api-1.0/group__dev.html#gab14d11ed6eac7519bb94795659d2c971
9085
// libusb_kernel_driver_active / libusb_attach_kernel_driver / libusb_detach_kernel_driver : "This functionality is not available on Windows."
9186
if ("win32" !== os.platform()) {
92-
9387
if(iface.isKernelDriverActive()) {
94-
9588
try {
9689
iface.detachKernelDriver();
9790
} catch(e) {
9891
console.error("[ERROR] Could not detatch kernel driver: %s", e)
9992
}
100-
10193
}
102-
10394
}
104-
10595
iface.claim(); // must be called before using any endpoints of this interface.
10696
iface.endpoints.filter(function(endpoint){
10797
if(endpoint.direction == 'out' && !self.endpoint) {
@@ -114,15 +104,11 @@ USB.prototype.open = function (callback){
114104
} else if(++counter === this.device.interfaces.length && !self.endpoint){
115105
callback && callback(new Error('Can not find endpoint from printer'));
116106
}
117-
118107
});
119-
120108
})(iface);
121-
122109
});
123-
124110
return this;
125-
111+
126112
};
127113

128114
/**

examples/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
'use strict';
22
const escpos = require('../');
33

4-
const device = new escpos.USB();
4+
const device = new escpos.USB(0x0416, 0x5011);
55
// const device = new escpos.Network('localhost');
66
// const device = new escpos.Serial('/dev/usb/lp0');
7-
87
const printer = new escpos.Printer(device);
98

10-
device.open(function(){
9+
device.open(function(err){
1110

1211
printer
1312
.font('a')

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "escpos",
3-
"version": "2.4.2",
3+
"version": "2.4.3",
44
"description": "ESC/POS Printer driver for nodejs",
55
"main": "index.js",
66
"scripts": {
@@ -17,7 +17,8 @@
1717
"author": "lsong",
1818
"contributors": [
1919
"Jose Vera <[email protected]>",
20-
"Sébastien Vidal <[email protected]>"
20+
"Sébastien Vidal <[email protected]>",
21+
"Yu Yongwoo <[email protected]>"
2122
],
2223
"license": "MIT",
2324
"bugs": {

screencasts/IMG_1031.JPG

2.46 MB
Loading

0 commit comments

Comments
 (0)