If i am not mistaken... interface claiming is an OS thing, not a
firmware-possible problem.

How can i know for sure that the interface is "claimed", and if
possible, force a "reclaim".

Also, when i press the key for second time, there is a big pause going
(like 3 secs), which shouldnt, because the timeout is set to 100.
And also, it seems that it doesnt fails inmediately, it loses the
claim after a few requests.
check this logs. LOG lines are all ok.





linux-7z8v:/home/diego/Desktop/TUSB3410/UTICOM/superterminal #
./capafisica_usb.py
Presione una tecla
LOG(capafisica): OPEN usb device  0
LOG(capafisica): SET Config GPIO  [0]
LOG(capafisica): SET GPIO(0x 3, 0xffff) 0
LOG(capafisica): PINGing device  15
LOG(capafisica): SET GPIO(0xff, 0x c) 0
LOG(capafisica): GET GPIO  3311
array('B', [72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33])
LOG(capafisica): SET GPIO(0xff, 0x c) 0
LOG(capafisica): GET GPIO  3311
array('B', [72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33])
LOG(capafisica): SET GPIO(0xff, 0x c) 0
LOG(capafisica): GET GPIO  3215
array('B', [72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33])
LOG(capafisica): SET GPIO(0xff, 0x c) 0
LOG(capafisica): GET GPIO  3215
array('B', [72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33])
Presione una tecla
<-------------------------------------------------------------------------------------------
HERE THERE IS A BIG DEADTIME
LOG(capafisica): OPEN usb device  0
LOG(capafisica): SET Config GPIO  [0]
LOG(capafisica): SET GPIO(0x 3, 0xffff) 0
LOG(capafisica): PINGing device  15
LOG(capafisica): SET GPIO(0xff, 0x c) 0
LOG(capafisica): GET GPIO  3247
_check ERROR:  -1 Input/output error
----> ERROR(capafisica): EXCEPTION trying to send data with
(timeout,error)  <class 'usb.core.USBError'>
====> DEBUG(capafisica): ----------------- USBError('Input/output error',)
  File "./capafisica_usb.py", line 203, in try_send
....




2010/7/9 Wander Lairson <wander.lair...@gmail.com>:
> 2010/7/9 Diego Jacobi <jacobidi...@gmail.com>:
>> Hi.
>>
>> As you may know, i am working in a device using an TUSB3410 with my
>> own firmware.
>>
>> Most is working.
>> I plug the device it logs in linux correctly and i am able to detach
>> the driver and make usb requests with pyusb.
>>
>> The problem comes when it has deadtime between calls then i get the
>> next message in dmesg:
>>
>> usb 3-2: usbfs: process 7564 (python) did not claim interface 0 before use
>>
>> I can not find any method for claiming interface in pyusb. Is there one?
>
> PyUSB 1.0 manages interface claiming automatically, but it can only do
> so if all stuff is done through PyUSB. It interface is released
> outside
> PyUSB, it cannot figure it out. Also, this might be a bug in PyUSB.
>
>>
>> Some more details:
>>
>> I made a class to handle the requests (capafisica) and a test scenario:
>>
>> if __name__ == '__main__':
>>    fisica = capafisica()
>>    fisica.logging = fisica.LOGGING_DEBUG
>>    while raw_input("Presione una tecla")>0:
>>        fisica.try_start()
>>        fisica.test()
>>        fisica.set_gpio(0xFF,mask=0x0C)
>>        fisica.get_gpio()
>>        fisica.try_send("Hello World!")
>>        print fisica.try_recv()
>>
>>
>> When i press a key it launches the set of functions and all works
>> correctly. IF i press a key again, then most of them fails, i may say,
>> randomly. AND this error message in dmesg appears.
>>
>> However if i edit the test scenario to:
>>
>> if __name__ == '__main__':
>>    fisica = capafisica()
>>    fisica.logging = fisica.LOGGING_DEBUG
>>    while raw_input("Presione una tecla")>0:
>>        fisica.try_start()
>>        fisica.test()
>>        fisica.set_gpio(0xFF,mask=0x0C)
>>        fisica.get_gpio()
>>        fisica.try_send("Hello World!")
>>        print fisica.try_recv()
>>        fisica.try_start()
>>        fisica.test()
>>        fisica.set_gpio(0xFF,mask=0x0C)
>>        fisica.get_gpio()
>>        fisica.try_send("Hello World!")
>>        print fisica.try_recv()
>>        fisica.try_start()
>>        fisica.test()
>>        fisica.set_gpio(0xFF,mask=0x0C)
>>        fisica.get_gpio()
>>        fisica.try_send("Hello World!")
>>        print fisica.try_recv()
>>        fisica.try_start()
>>        fisica.test()
>>        fisica.set_gpio(0xFF,mask=0x0C)
>>        fisica.get_gpio()
>>        fisica.try_send("Hello World!")
>>        print fisica.try_recv()
>>
>>
>> Then all the calls works.
>> In that way i discard that can be a problem in my firmware. Well, i do
>> not discard it completely, but i need to know how to "claim the
>> interface"
>>
>>
>>
>> Thanks
>> Diego
>>
>> ------------------------------------------------------------------------------
>> This SF.net email is sponsored by Sprint
>> What will you do first with EVO, the first 4G phone?
>> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
>> _______________________________________________
>> pyusb-users mailing list
>> pyusb-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/pyusb-users
>>
>
>
>
> --
> Best Regards,
> Wander Lairson Costa
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> pyusb-users mailing list
> pyusb-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pyusb-users
>

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Reply via email to