On Sat, May 26, 2012 at 6:35 PM, Xiaofan Chen <xiaof...@gmail.com> wrote:
> 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."

Hmm, it does seem to honor the environment variable.

The only thing is that I was confused by Pete's statement that "It only
displays the timestamp and thread ID if the global logging level
has been set to debug".

I think that statement is not totally correct. In the case of
"xusb -d" example, the error message will have the timestamp
no matter the logging level setting.

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

Opening device...
[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
[ 0.157596] [00000e07] libusbx: error [darwin_open] USBDeviceOpen:
another process has device opened for exclusive access
[ 0.538286] [00000e07] libusbx: warning
[darwin_cache_device_descriptor] could not retrieve device descriptor
05ac:8281: device not responding. skipping device
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.694969] [00000e07] libusbx: error [darwin_claim_interface]
IOCreatePlugInInterfaceForService: unknown error
   Failed.

Reading string descriptors:
[ 0.695012] [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