On Sat, May 26, 2012 at 6:26 PM, Xiaofan Chen <xiaof...@gmail.com> wrote:
> On Fri, May 25, 2012 at 2:01 AM, Pete Batard <p...@akeo.ie> wrote:
>> This one does a few things:
>>
>> 1. It sets the origin of the timestamps to the first libusb_init() call
>> issued by the application. The idea is to avoid getting an arbitrary origin
>> once we have toggleable logging, as it is currently set to the first debug
>> message ever issued, which isn't something an app developer can reference
>> against as it could occur wherever.
>>
>> 2. It only displays the timestamp and thread ID if the global logging level
>> has been set to debug. The rationale behind that is that, outside of debug,
>> logging messages are expected to be sparse and likely to only occur for
>> errors and warnings. As such, timestamping and thread ID are probably be
>> irrelevant for the app developer, even more so if they only get one
>> error/warning during the course of the app.
>>
>
> I think the idea behind the above is good.
>
> But somehow it does not seem to work. Maybe what I really need is
> the next Toggle-able logging.
>
> mymacmini:examples xiaofanc$ export LIBUSB_DEBUG=1
>
> mymacmini:examples xiaofanc$ ./xusb -d 0424:2513

Hmm, it does seem to work. "xusb -d" is probably different
and strangely it does not seem to honor the LIBUSB_DEBUG environment
variable.
http://libusbx.sourceforge.net/api-1.0/group__lib.html
"If the LIBUSB_DEBUG environment variable was set when libusbx was
initialized, this function does nothing: the message verbosity is fixed to
the value in the environment variable."


mymacmini:~ xiaofanc$ export LIBUSB_DEBUG=3
mymacmini:~ xiaofanc$ env | grep LIBUSB
LIBUSB_DEBUG=3
mymacmini:examples xiaofanc$ ./listdevs
[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------
[ 0.000000] [00000e07] libusbx: warning
[darwin_cache_device_descriptor] could not retrieve device descriptor
05ac:8281: device not responding. skipping device
05ac:8006 (bus 250, device 1)
0424:2513 (bus 250, device 2)
04f2:0760 (bus 250, device 4)
05e3:0606 (bus 250, device 5)
1366:0101 (bus 250, device 6)
046d:c52b (bus 250, device 8)
046d:c054 (bus 250, device 9)
05ac:8006 (bus 253, device 1)
0424:2513 (bus 253, device 2)
05ac:8242 (bus 253, device 3)
0ac8:3420 (bus 253, device 4)
mymacmini:examples xiaofanc$ export LIBUSB_DEBUG=1
mymacmini:examples xiaofanc$ ./listdevs
05ac:8006 (bus 250, device 1)
0424:2513 (bus 250, device 2)
04f2:0760 (bus 250, device 4)
05e3:0606 (bus 250, device 5)
1366:0101 (bus 250, device 6)
046d:c52b (bus 250, device 8)
046d:c054 (bus 250, device 9)
05ac:8006 (bus 253, device 1)
0424:2513 (bus 253, device 2)
05ac:8242 (bus 253, device 3)
0ac8:3420 (bus 253, device 4)

mymacmini:examples xiaofanc$ ./xusb -d 0424:2513
Using libusbx v1.0.11.10507

Opening device...
[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------
[ 0.000000] [00000e07] libusbx: error [darwin_open] USBDeviceOpen:
another process has device opened for exclusive access
bus: 250, port path from HCD: 1
speed: 480 Mbit/s (USB 2.0 HighSpeed)

Reading device descriptor:
            length: 18
      device class: 9
               S/N: 0
           VID:PID: 0424:2513
         bcdDevice: 0BB3
   iMan:iProd:iSer: 0:0:0
          nb confs: 1

Reading configuration descriptors:
             nb interfaces: 1
              interface[0]: id = 0
interface[0].altsetting[0]: num endpoints = 1
   Class.SubClass.Protocol: 09.00.01
       endpoint[0].address: 81
           max packet size: 0001
          polling interval: 0C
interface[0].altsetting[1]: num endpoints = 1
   Class.SubClass.Protocol: 09.00.02
       endpoint[0].address: 81
           max packet size: 0001
          polling interval: 0C

Claiming interface 0...
[ 0.535504] [00000e07] libusbx: error [darwin_claim_interface]
IOCreatePlugInInterfaceForService: unknown error
   Failed.

Reading string descriptors:
[ 0.535565] [00000e07] libusbx: error [submit_control_transfer]
control request failed: no async port has been opened for interface

Releasing interface 0...
Closing device...

-- 
Xiaofan

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to