Our express partner will perform scheduled system maintenance from 19th Jan to 3rd Feb, so during this time, all the orders in our webshop will be handled from 4th Feb.
Sorry for any inconvenience caused.

About pyusb

JavaCard Applet Development Related Questions and Answers.
DaHuFa
Posts: 53
Joined: Mon Jun 04, 2018 5:07 am
Points :390
Contact:

About pyusb

Post by DaHuFa » Wed Mar 11, 2020 2:43 am

I want use pyusb to test my CCID device. But I'm new to pyusb. I installed pyusb and liusb. But when I called get_active_configuration() or set_configuration(), I got the "Operation not supported or unimplemented on this platform" information. Why?

DaHuFa
Posts: 53
Joined: Mon Jun 04, 2018 5:07 am
Points :390
Contact:

Re: About pyusb

Post by DaHuFa » Wed Mar 11, 2020 2:45 am

Did my smartcard reader driver cause this question?

DaHuFa
Posts: 53
Joined: Mon Jun 04, 2018 5:07 am
Points :390
Contact:

Re: About pyusb

Post by DaHuFa » Thu Mar 12, 2020 2:13 am

Now I resolved this problem by installed the newest libusb(libusb-1.0.22). And set_configuration() worked rightly. But a new question appread. Tt is write function.

Code: Select all

dev = usb.core.find(idVendor=0x096e, idProduct=0x0856)

dev.set_configuration()
cfg = dev.get_active_configuration()

for intf in cfg:
    if intf.bInterfaceClass == 0x0B: #smart card
        break
        
out_ep = None
in_ep = None
for ep in intf:
    if usb.util.endpoint_direction(ep.bEndpointAddress) == usb.util.ENDPOINT_IN:
        in_ep = ep
    if usb.util.endpoint_direction(ep.bEndpointAddress) == usb.util.ENDPOINT_OUT:
        out_ep = ep

print out_ep
print in_ep
dev.ctrl_transfer(bmRequestType=0x80, bRequest=0x06, wValue=0x0302, wIndex=0x0409, data_or_wLength=0x0018)
out.write('\x63\x00\x00\x00\x00\x00\x00\x00\x00\x00')
The error appeared when PC processing out.write function:
NotImplementedError: Operation not supported or unimplemented on this platform
:?: :?: :?:

lucas21
Posts: 1
Joined: Thu Mar 26, 2020 5:13 am
Points :8
Contact:

Re: About pyusb

Post by lucas21 » Thu Mar 26, 2020 5:17 am

Thanks for the information!

DaHuFa
Posts: 53
Joined: Mon Jun 04, 2018 5:07 am
Points :390
Contact:

Re: About pyusb

Post by DaHuFa » Fri Apr 24, 2020 2:54 am

Now, I'm getting a little clearer on Libusb. winUSB is the grandfather. libusb is the son. pyusb is grandson. All operations base on winUSB. libusb is only a lib. It encapsulates winUSB operations and provides a uniform interfaces. pyusb is python module. If I use C language, I can use libusb too.

DaHuFa
Posts: 53
Joined: Mon Jun 04, 2018 5:07 am
Points :390
Contact:

Re: About pyusb

Post by DaHuFa » Thu May 14, 2020 6:16 am

If you want to work on libusb, the fist step is replacing your device driver. I usb "zadig-2.5.exe" replaced my CCID reader. I can send apdu and recv sw now. :lol:

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 11 guests

JavaCard OS : Disclaimer