1
我在當前具有ARMv7內部目標硬件(實用程序標準)上遇到問題。在usb模塊中使用node.js時,它在我的pc上運行良好,但現在在使用usb模塊的transmit-method讀取設備時將其移植到目標時存在問題。node.js usb在Ubuntu 12.04 Arm 7下的InEndpoint錯誤Cortex
這裏有系統的一些細節:
Linux utilite-ubuntu-desktop 3.0.35-cm-fx6-4 #123 SMP Thu Sep 12 10:41:30 IST 2013 armv7l armv7l armv7l GNU/Linux
libusb version: 1.0-9 or 1.0-18 (both tested)
node.js version: 0.10.22 (highest 0.10.x version to run on the target)
usb version: latest, (but also others tested downto 2.0)
的錯誤,我得到的是如下(按順序):
{ [Error: **UNKNOWN**] errno: 6 }
或
{ [Error: **UNKNOWN**] errno: 2 }
我擡頭似乎直接來自libusb(errno.h)的錯誤號碼:
#define ENOFILE 2 /* No such file or directory */
#define ENOENT 2
#define ENXIO 6 /* No such device or address */
我的應用程序的源代碼是:
var usb = require('usb');
var panel_on_USB = usb.findByIds(conf.USB_VID, conf.USB_PID);
panel_on_USB.open();
console.log("interface :");
console.log(panel_on_USB.interface(0));
console.log("timeout :" + panel_on_USB.timeout);
var panel_interface = panel_on_USB.interface(0);
panel_interface.claim();
console.log("isKernelDriverActive: " + panel_interface.isKernelDriverActive());
console.log("descriptor: " + panel_interface.descriptor);
console.log("panel_interface: " + panel_interface.endpoints);
console.log("LIBUSB_ENDPOINT_IN = " + usb.LIBUSB_ENDPOINT_IN);
console.log("LIBUSB_ENDPOINT_OUT = " + usb.LIBUSB_ENDPOINT_OUT);
console.log(panel_interface.endpoint(1).direction);
console.log(panel_interface.endpoint(2).direction);
console.log(panel_interface.endpoint(131).direction);
console.log(panel_interface.endpoint(132).direction);
輸出到控制檯:
interface :
{ device:
{ busNumber: 2,
deviceAddress: 3,
deviceDescriptor:
{ bLength: 18,
bDescriptorType: 1,
bcdUSB: 512,
bDeviceClass: 0,
bDeviceSubClass: 0,
bDeviceProtocol: 0,
bMaxPacketSize0: 8,
idVendor: 1240,
idProduct: 62765,
bcdDevice: 0,
iManufacturer: 1,
iProduct: 2,
iSerialNumber: 0,
bNumConfigurations: 1 },
interfaces: [ [Circular] ] },
id: 0,
altSetting: 0,
descriptor:
{ bLength: 9,
bDescriptorType: 4,
bInterfaceNumber: 0,
bAlternateSetting: 0,
bNumEndpoints: 4,
bInterfaceClass: 255,
bInterfaceSubClass: 255,
bInterfaceProtocol: 255,
iInterface: 0,
extra: <Buffer >,
endpoints: [ [Object], [Object], [Object], [Object] ] },
interfaceNumber: 0,
endpoints:
[ { device: [Object],
descriptor: [Object],
address: 1,
transferType: 2 },
{ device: [Object],
descriptor: [Object],
address: 2,
transferType: 2 },
{ device: [Object],
descriptor: [Object],
address: 131,
transferType: 2 },
{ device: [Object],
descriptor: [Object],
address: 132,
transferType: 2 } ] }
timeout :1000
isKernelDriverActive: true
descriptor: [object Object]
panel_interface: [object Object],[object Object],[object Object],[object Object]
LIBUSB_ENDPOINT_IN = 128
LIBUSB_ENDPOINT_OUT = 0
out
out
in
in
生成錯誤轉移呼叫:
panel_interface.endpoint(131).transfer(Length_Total_Bytes, function(error, data){
if(error){
//if(conf.Debug_Console_Output){
console.log("USB_receive_Error:");
console.log(error);
//}
}
//...Data Handling done here...//
});
瞭解這個任何想法?