I re-read the reference manual for the reader and I made few changes on the
data which I need to send.
At the moment I am quite sure about the format of the data which I need to
send (header, device_id, command_id, parameters, crc16).
This is the update for the code
======================================================================
HEADER = bytearray([0x4D, 0x54, 0x49, 0x43])
DEVICE_ID = bytearray([0x00])
COMMAND_ID = bytearray([0x03]) # for retrieving the operation mode
PARAMETERS = bytearray([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])
command_packet = HEADER + DEVICE_ID + COMMAND_ID + PARAMETERS
checksum = crc16(command_packet)
complete_command_packet = command_packet + bytearray([checksum & 0xff,
((checksum >> 8) & 0xFF)])
device.write(0x01, complete_command_packet)
print device.read(0x82, 16, 1000)
=====================================================================
I found an different error message when the device.read method is invoked.
AttributeError: 'NoneType' object has no attribute 'bInterfaceNumber'
Any idea about the error message?
Kindest regards,
Budi
=========================
<boedy.b...@gmail.com> <http://goo.gl/T5NDnD> <http://goo.gl/4xmCrj>
<http://goo.gl/f2Dj7Q> <http://goo.gl/TlJuEd>
<http://goo.gl/d6J1aE> <http://goo.gl/8ezaYx>
=========================
*Please consider the environment *
*before printing this email*
On Wed, Feb 12, 2014 at 11:06 PM, Setia Budi <boedy.b...@gmail.com> wrote:
> Ok I will give a try tomorrow :)
> Thank you for the advice :)
>
> Budi
>
> =========================
> <boedy.b...@gmail.com> <http://goo.gl/T5NDnD> <http://goo.gl/4xmCrj>
> <http://goo.gl/f2Dj7Q> <http://goo.gl/TlJuEd>
>
> <http://goo.gl/d6J1aE> <http://goo.gl/8ezaYx>
> =========================
> *Please consider the environment *
> *before printing this email*
>
>
> On Wed, Feb 12, 2014 at 9:52 PM, Wander Lairson Costa <
> wander.lair...@gmail.com> wrote:
>
>> 2014-02-11 20:11 GMT-02:00 Setia Budi <boedy.b...@gmail.com>:
>> > This is the output for lsusb -v -d 24e9:0824
>> >
>> > Bus 002 Device 007: ID 24e9:0824
>> > Device Descriptor:
>> > bLength 18
>> > bDescriptorType 1
>> > bcdUSB 1.10
>> > bDeviceClass 255 Vendor Specific Class
>> > bDeviceSubClass 0
>> > bDeviceProtocol 255
>> > bMaxPacketSize0 8
>> > idVendor 0x24e9
>> > idProduct 0x0824
>> > bcdDevice 0.01
>> > iManufacturer 1 MICROELECTRONICS TECHNOLOGY INC.
>> > iProduct 2 MTI UHF RFID PRODUCT
>> > iSerial 3 1326U0002
>> > bNumConfigurations 1
>> > Configuration Descriptor:
>> > bLength 9
>> > bDescriptorType 2
>> > wTotalLength 41
>> > bNumInterfaces 1
>> > bConfigurationValue 1
>> > iConfiguration 0
>> > bmAttributes 0xc0
>> > Self Powered
>> > MaxPower 500mA
>> > Interface Descriptor:
>> > bLength 9
>> > bDescriptorType 4
>> > bInterfaceNumber 0
>> > bAlternateSetting 0
>> > bNumEndpoints 2
>> > bInterfaceClass 3 Human Interface Device
>> > bInterfaceSubClass 0 No Subclass
>> > bInterfaceProtocol 0 None
>> > iInterface 0
>> > HID Device Descriptor:
>> > bLength 9
>> > bDescriptorType 33
>> > bcdHID 1.11
>> > bCountryCode 0 Not supported
>> > bNumDescriptors 1
>> > bDescriptorType 34 Report
>> > wDescriptorLength 98
>> > Report Descriptor: (length is 98)
>> > Item(Global): Usage Page, data= [ 0x00 0xff ] 65280
>> > (null)
>> > Item(Local ): Usage, data= [ 0x01 ] 1
>> > (null)
>> > Item(Main ): Collection, data= [ 0x01 ] 1
>> > Application
>> > Item(Global): Report ID, data= [ 0x43 ] 67
>> > Item(Global): Report Count, data= [ 0x0f ] 15
>> > Item(Global): Report Size, data= [ 0x08 ] 8
>> > Item(Global): Logical Minimum, data= [ 0x00 ] 0
>> > Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
>> > Item(Local ): Usage, data= [ 0x01 ] 1
>> > (null)
>> > Item(Main ): Output, data= [ 0x02 ] 2
>> > Data Variable Absolute No_Wrap Linear
>> > Preferred_State No_Null_Position
>> Non_Volatile
>> > Bitfield
>> > Item(Global): Report ID, data= [ 0x52 ] 82
>> > Item(Global): Report Count, data= [ 0x0f ] 15
>> > Item(Global): Report Size, data= [ 0x08 ] 8
>> > Item(Global): Logical Minimum, data= [ 0x00 ] 0
>> > Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
>> > Item(Local ): Usage, data= [ 0x01 ] 1
>> > (null)
>> > Item(Main ): Input, data= [ 0x02 ] 2
>> > Data Variable Absolute No_Wrap Linear
>> > Preferred_State No_Null_Position
>> Non_Volatile
>> > Bitfield
>> > Item(Global): Report ID, data= [ 0x42 ] 66
>> > Item(Global): Report Count, data= [ 0x17 ] 23
>> > Item(Global): Report Size, data= [ 0x08 ] 8
>> > Item(Global): Logical Minimum, data= [ 0x00 ] 0
>> > Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
>> > Item(Local ): Usage, data= [ 0x01 ] 1
>> > (null)
>> > Item(Main ): Input, data= [ 0x02 ] 2
>> > Data Variable Absolute No_Wrap Linear
>> > Preferred_State No_Null_Position
>> Non_Volatile
>> > Bitfield
>> > Item(Global): Report ID, data= [ 0x41 ] 65
>> > Item(Global): Report Count, data= [ 0x3f ] 63
>> > Item(Global): Report Size, data= [ 0x08 ] 8
>> > Item(Global): Logical Minimum, data= [ 0x00 ] 0
>> > Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
>> > Item(Local ): Usage, data= [ 0x01 ] 1
>> > (null)
>> > Item(Main ): Input, data= [ 0x02 ] 2
>> > Data Variable Absolute No_Wrap Linear
>> > Preferred_State No_Null_Position
>> Non_Volatile
>> > Bitfield
>> > Item(Global): Report ID, data= [ 0x49 ] 73
>> > Item(Global): Report Count, data= [ 0x3f ] 63
>> > Item(Global): Report Size, data= [ 0x08 ] 8
>> > Item(Global): Logical Minimum, data= [ 0x00 ] 0
>> > Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
>> > Item(Local ): Usage, data= [ 0x01 ] 1
>> > (null)
>> > Item(Main ): Input, data= [ 0x02 ] 2
>> > Data Variable Absolute No_Wrap Linear
>> > Preferred_State No_Null_Position
>> Non_Volatile
>> > Bitfield
>> > Item(Global): Report ID, data= [ 0x45 ] 69
>> > Item(Global): Report Count, data= [ 0x17 ] 23
>> > Item(Global): Report Size, data= [ 0x08 ] 8
>> > Item(Global): Logical Minimum, data= [ 0x00 ] 0
>> > Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
>> > Item(Local ): Usage, data= [ 0x01 ] 1
>> > (null)
>> > Item(Main ): Input, data= [ 0x02 ] 2
>> > Data Variable Absolute No_Wrap Linear
>> > Preferred_State No_Null_Position
>> Non_Volatile
>> > Bitfield
>> > Item(Main ): End Collection, data=none
>> > Endpoint Descriptor:
>> > bLength 7
>> > bDescriptorType 5
>> > bEndpointAddress 0x01 EP 1 OUT
>> > bmAttributes 3
>> > Transfer Type Interrupt
>> > Synch Type None
>> > Usage Type Data
>> > wMaxPacketSize 0x0040 1x 64 bytes
>> > bInterval 1
>> > Endpoint Descriptor:
>> > bLength 7
>> > bDescriptorType 5
>> > bEndpointAddress 0x82 EP 2 IN
>> > bmAttributes 3
>> > Transfer Type Interrupt
>> > Synch Type None
>> > Usage Type Data
>> > wMaxPacketSize 0x0040 1x 64 bytes
>> > bInterval 1
>> > Device Status: 0x0001
>> > Self Powered
>> >
>>
>> To begin with, your former code can be summed up to this (with latest
>> git PyUSB):
>>
>> import usb.core
>> import usb.util
>> import sys
>>
>> VENDOR_ID = 0x24e9
>> PRODUCT_ID = 0x0824
>>
>> device = usb.core.find(idVendor=VENDOR_ID, idProduct=PRODUCT_ID)
>>
>> if device is None:
>> sys.exit("Could not find Id System Barcode Reader.")
>> else:
>> print 'Device detected'
>>
>> device.set_configuration()
>>
>> device.write(0x01, [0x01]) ---> you probably meant [0x01] or '\x01'
>> instead of '0x01'
>> print device.read(0x82, 64, 1000)
>>
>> If you are still getting a read timeout, that is probably because the
>> 0x01 command means nothing to the device.
>>
>> --
>> Best Regards,
>> Wander Lairson Costa
>>
>>
>> ------------------------------------------------------------------------------
>> Android apps run on BlackBerry 10
>> Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
>> Now with support for Jelly Bean, Bluetooth, Mapview and more.
>> Get your Android app in front of a whole new audience. Start now.
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
>> _______________________________________________
>> pyusb-users mailing list
>> pyusb-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/pyusb-users
>>
>
>
------------------------------------------------------------------------------
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience. Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users