本文整理汇总了Python中usb.util.get_string函数的典型用法代码示例。如果您正苦于以下问题:Python get_string函数的具体用法?Python get_string怎么用?Python get_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_string函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: listPrinters
def listPrinters(self):
printers = core.find(find_all=True) # , bDeviceClass=7)
for printer in printers:
print printer.bDeviceClass
try:
print util.get_string(printer, 256, 3)
except:
print 'dispositivo oculto'
示例2: _try_get_string
def _try_get_string(dev, index, langid = None, default_str_i0 = "",
default_access_error = "Error Accessing String"):
""" try to get a string, but return a string no matter what
"""
if index == 0 :
string = default_str_i0
else:
try:
if langid is None:
string = util.get_string(dev, index)
else:
string = util.get_string(dev, index, langid)
except :
string = default_access_error
return string
示例3: manufacturer
def manufacturer(self):
""" Return the USB device's manufacturer string descriptor.
This property will cause some USB traffic the first time it is accessed
and cache the resulting value for future use.
"""
if self._manufacturer is None:
self._manufacturer = util.get_string(self, self.iManufacturer)
return self._manufacturer
示例4: __getName
def __getName(self,pen):
"""
Get pen's name for user displaying
"""
name = (util.get_string(dev=pen,length=20,index=1))+" "+(util.get_string(dev=pen,length=20,index=2))
return name
示例5: product
def product(self):
""" Return the USB device's product string descriptor.
This property will cause some USB traffic the first time it is accessed
and cache the resulting value for future use.
"""
if self._product is None:
self._product = util.get_string(self, self.iProduct)
return self._product
示例6: serial_number
def serial_number(self):
""" Return the USB device's serial number string descriptor
This property will cause some USB traffic the first time it is accessed
and cache the resulting value for future use.
"""
if self._serial_number is None:
self._serial_number = util.get_string(self, self.iSerialNumber)
return self._serial_number
示例7: getString
def getString(self, index, length, langid = None):
r"""Retrieve the string descriptor specified by index
and langid from a device.
Arguments:
index: index of descriptor in the device.
length: number of bytes of the string
langid: Language ID. If it is omittedi, will be
used the first language.
"""
return util.get_string(self.dev, length, index, langid).encode('ascii')
示例8: serial_number
def serial_number(self):
return util.get_string(self, 1000, self.iSerialNumber)
示例9: product
def product(self):
return util.get_string(self, 1000, self.iProduct)
示例10: manufacturer
def manufacturer(self):
return util.get_string(self, 1000, self.iManufacturer)
示例11: get_string
def get_string(self, num):
return get_string(self.__dev, num)