Re: [pyusb-users] pyusb and root permissions "ValueError: The device has no langid"
Permissions deal with your Linux configuration. Here is a general answer for Linux. http://unix.stackexchange.com/questions/44308/understanding-udev-rules-and-permissions-in-libusb You can google for libusb permissions for your distribution if this doesn't lead to a solution. > On Aug 20, 2016, at 07:46, Jay Aurabindwrote: > > Hi, > > I am a user of pyOCD, and I am having an issue related to pyusb which > is what the former uses for talking to the USB device. The situation > is that I need to use pyOCD through an eclipse plugin. Eclipse > launches pyocd-gdbserver and normal user. But it will only work if > launched as root. > > My question is, how can I make pysb do its job without requiring root > permissions? Here is the error I get when launching pyocd-gdbserver as > normal user. The last lines suggests its pyusb having issues: > > uncaught exception: The device has no langid > Traceback (most recent call last): > File "build/bdist.linux-x86_64/egg/pyOCD/tools/gdb_server.py", line > 262, in run >frequency=self.args.frequency) > File "build/bdist.linux-x86_64/egg/pyOCD/board/mbed_board.py", line > 210, in chooseBoard >target_override, frequency) > File "build/bdist.linux-x86_64/egg/pyOCD/board/mbed_board.py", line > 182, in getAllConnectedBoards >connected_daps = dap_class.get_connected_devices() > File > "build/bdist.linux-x86_64/egg/pyOCD/pyDAPAccess/dap_access_cmsis_dap.py", > line 352, in get_connected_devices >all_interfaces = _get_interfaces() > File > "build/bdist.linux-x86_64/egg/pyOCD/pyDAPAccess/dap_access_cmsis_dap.py", > line 44, in _get_interfaces >return INTERFACE[usb_backend].getAllConnectedInterface() > File > "build/bdist.linux-x86_64/egg/pyOCD/pyDAPAccess/interface/pyusb_backend.py", > line 88, in getAllConnectedInterface >product = board.product > File "/usr/lib/python2.7/site-packages/usb/core.py", line 841, in product >self._product = util.get_string(self, self.iProduct) > File "/usr/lib/python2.7/site-packages/usb/util.py", line 314, in get_string >raise ValueError("The device has no langid") > ValueError: The device has no langid > > > Please let me know if there are any workarounds to make pyusb work > without requiring root privilege. > > -- > > Thanks and Regards, > Aurabindo J > > -- > ___ > pyusb-users mailing list > pyusb-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/pyusb-users -- ___ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users
Re: [pyusb-users] Barcode Scanner
John, Not knowing your exact barcode scanner is a real hindrance. One good piece of information you forgot to provide was what exactly you were interfacing to. USB barcode scanner is too generic, you need read http://catb.org/esr/faqs/smart-questions.html That being said the VID is from Honeywell, so here is on of their manuals for a 2d barcode reader. See page 2-4 of http://www.honeywellaidc.com/CatalogDocuments/Xenon-UG.pdf Clearly it states that to enable the USB CDC mode you scan that barcode. To enable USB-CDC mode of the barcode scanner. Windows needs a driver, but mac and linux will use the generic USB-CDC driver. Now you will connect with pySerial and communicate with your barcode scanner as a serial device. Happy hacking, Steve > On Apr 24, 2016, at 7:22 AM, Dietmar Schwertberger >wrote: > > On 24.04.2016 14:34, John Thornton wrote: >> I've established communications with it and added a udev rule and added >> myself to the scanner group so I could talk to the scanner. And the >> results so far are: > A long way to go... > >> On 4/24/2016 6:06 AM, Dietmar Schwertberger wrote: >>> button and they send keystrokes. >>> You should have info from the manufacturer of your scanner. Maybe he has >>> implemented CDC (aka Virtual COM Port). > For Windows, Honeywell offers a USB Serial Driver. > So you may try CDC as well, either as serial port or via pyusb. > > Regards, > > Dietmar > > -- > Find and fix application performance issues faster with Applications Manager > Applications Manager provides deep performance insights into multiple tiers of > your business applications. It resolves application problems quickly and > reduces your MTTR. Get your free trial! > https://ad.doubleclick.net/ddm/clk/302982198;130105516;z > ___ > pyusb-users mailing list > pyusb-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/pyusb-users -- Find and fix application performance issues faster with Applications Manager Applications Manager provides deep performance insights into multiple tiers of your business applications. It resolves application problems quickly and reduces your MTTR. Get your free trial! https://ad.doubleclick.net/ddm/clk/302982198;130105516;z ___ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users
Re: [pyusb-users] Change suggestion
On Jun 20, 2015, at 2:10 AM, Tormod Volden lists.tor...@gmail.com wrote: On Fri, Jun 19, 2015 at 4:12 PM, Hermann Hamann wrote: I am sorry, but I am too old and too stupid to learn on the fly how to use a github pull request to push some files. So I use the stone age way to attach the modified files core.py and libusb1.py to this mail, hoping, that some kind soul will find them and treat them as required. Hermann, What version of pyusb are your changes based on? Without knowing this, it is difficult to figure out exactly what are your changes. You are giving the maintainer a lot of extra work by just dumping your files on him. At least, use a diff utility to make a machine-readable diff instead. BTW, the original diff was made in the seventies, so age is no excuse. Regards, Tormod -- ___ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users Hermann, Presuming that you used git to clone the source repository there is one of the few basic git commands to get a properly formatted patch that tracks the source revision. Please use git format-patch to generate diffs based upon the checkout that you worked against. `git format-patch origin/master` As for pull requests in github, you are not too stupid nor too old. Your self deprecation begs for mockery from others. I accept no ageism, my grandmother was an avid computer user, that was self taught when she was 62, on a 8088 IBM PC clone. 1. Fork the pyusb repository. 2. Commit your changes to a branch in your new fork on your computer. 3. Push your changes to in the forked repository on github. 4. Submit a pull request for that new branch against the pyusb repository. Please refer to this documentation from github. https://help.github.com/articles/using-pull-requests/ https://help.github.com/articles/using-pull-requests/ Steve -- ___ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users
Re: [pyusb-users] Significance of 'B' Character in Data Arrays
Jared, You were close, 8.6 of the docs is what you were looking for. See https://docs.python.org/2/library/array.html for full description of the python array standard library module. If you don't have a need to run python 2.7, I suggest using Python 3 it copes with bytes and strings more explicitly. Working with low level stuff i fond it more useful than coercing python 2 to work properly with bytes and strings (unicode) Especially when I use utf-8 in my programs. Steve On Sep 29, 2014, at 8:06 PM, Jared Contrascere jared.n.contrasc...@libretees.com wrote: Hello! I've managed to read data! At this point, I need to decipher it. I wanted to confirm my suspicion that the B in the following array: array('B', [3, 4, 2, 0, 22, 0]) Signifies that an unsigned char is being received from the backend library, similar to what is seen in the table section 7.3.2.2 at https://docs.python.org/2/library/struct.html Is this the case? Thanks in advance! Best, Jared -- Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer http://pubads.g.doubleclick.net/gampad/clk?id=154622311iu=/4140/ostg.clktrk___ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users -- Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer http://pubads.g.doubleclick.net/gampad/clk?id=154622311iu=/4140/ostg.clktrk___ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users
Re: [pyusb-users] [PATCH] Fix: keep compatibility with Python 3.3.
How can the user decide in your method? I don't see it. Steve On Jan 27, 2013, at 3:15 AM, Wander Lairson Costa wander.lair...@gmail.com wrote: 2013/1/26 Steven Michalske smichal...@gmail.com: What about this? Tested in python 2.7 and 3.3 a = array.array(B) s=uabcꬦ try: a.fromstring(s.encode('ascii')) except UnicodeEncodeError: a.fromstring(s.encode('utf8')) print(a) array('B', [97, 98, 99, 234, 172, 166]) a = array.array(B) s=abc try: a.fromstring(s.encode('ascii')) except UnicodeEncodeError: a.fromstring(s.encode('utf8')) I think is better to let the user decides which encoding he prefers. -- Best Regards, Wander Lairson Costa -- Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnnow-d2d ___ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users -- Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnnow-d2d ___ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users
Re: [pyusb-users] [PATCH] Fix: keep compatibility with Python 3.3.
On Jan 27, 2013, at 3:35 PM, Wander Lairson Costa wander.lair...@gmail.com wrote: _interop.as_array(s.encode('ut8')) Ahh, I read the _ and thought it was a private module.-- Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnnow-d2d___ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users
Re: [pyusb-users] [PATCH] Fix: keep compatibility with Python 3.3.
What about this? Tested in python 2.7 and 3.3 a = array.array(B) s=uabcꬦ try: a.fromstring(s.encode('ascii')) except UnicodeEncodeError: a.fromstring(s.encode('utf8')) print(a) array('B', [97, 98, 99, 234, 172, 166]) a = array.array(B) s=abc try: a.fromstring(s.encode('ascii')) except UnicodeEncodeError: a.fromstring(s.encode('utf8')) On Jan 26, 2013, at 11:04 AM, wander.lair...@gmail.com wrote: From: Wander Lairson Costa wander.lair...@gmail.com In usb/_interop.py in the as_array function, the array typecodes 'c' and 'u' are used. The 'c' typecode was removed from python 3.3 and 'u' will is deprecated. The solution is to use the fromstring array method, but it has the side effect of adding only the first byte of Unicode strings. --- usb/_interop.py |7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/usb/_interop.py b/usb/_interop.py index 5abdcdb..d6d0a6c 100644 --- a/usb/_interop.py +++ b/usb/_interop.py @@ -131,8 +131,7 @@ def as_array(data=None): except TypeError: # When you pass a unicode string or a character sequence, # you get a TypeError if first parameter does not match -try: -return array.array('c', data) -except TypeError: -return array.array('u', data) +a = array.array('B') +a.fromstring(data) +return a -- 1.7.10.4 -- Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnnow-d2d ___ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users -- Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnnow-d2d ___ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users
Re: [pyusb-users] bulkWrite of character sequence
On Mar 29, 2012, at 7:30 PM, Tormod Volden lists.tor...@gmail.com wrote: On Thu, Mar 29, 2012 at 12:32 PM, Wander Lairson Costa wrote: Yes, this is a known problem that was already reported before. PyUSB 0.4 was very flexible in managing the buffer types, and PyUSB 1.0 is not that so. I could not find yet a simple and elegant solution for this problem, but try to mimic to behavior of the C version of PyUSB. Thanks. I could not find it in the bug tracker, but I found a post from Sarah Messer seeing the same problem here: http://sourceforge.net/mailarchive/message.php?msg_id=27131804 Maybe we should just try return array.array('c', data) before or after trying array.array('u', data)? BTW, how is the use of unicode strings meant to work? Each string character LSB is sent to the device? My recommendation is that UTF16 and UTF32 be an exception unless a byte order is specified or BOM is present. Other option is to default to little endian, as USB is intel driven. Then let it be overridden to big endian. Steve -- This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure ___ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users
Re: [pyusb-users] interruptWrite gives unknown USB error
Hi, 2 things. 1. Read the USB TMC specification, it has a structure that must wrap the commands to the device. See test measurement class on this page http://www.usb.org/developers/devclass_docs#approved 2. The Agilent USB DAQ devices I have used in the past use a cypress EZ-usb chip. This means that when the device is first plugged into the computer it gets it's firmware boot loaded. What this means for you is that you need to boot load the firmware first then you will get a USB-TMC device. Also, neglecting the firmware boot loading issue, have a look at this. http://www.home.agilent.com/upload/cmc_upload/All/usbtmc.html Steve On Jun 2, 2010, at 8:56 AM, Ct Chev wrote: Hello, I am trying to send SCPI (text) commands to an Agilent U2100A Digital IO via USB. I have used Python to send SCPI commands to other equipment successfully in the past using the parallel port or over ethernet. However this is my first time working with a USB device and Python. I can successfully run usbenum.py and the results are shown at the bottom for the device of interest. I then add the following lines within the 'for dev in devices' loop: if dev.idVendor == 2391: handle=dev.open() handle.setConfiguration(1) handle.setAltInterface(0) handle.interruptWrite(2, *IDN?\n) handle.releaseInterface() (*IDN? is a standard IEEE-488 command to return the instrument's identification string. I'm just using this to test the ability to send a command) and I get the following error: Traceback (most recent call last): File usbenum.py, line 46, in module handle.interruptWrite(2, *IDN?\n) usb.USBError: Unknown error Do you have any suggestions for what I am doing wrong? I tried using bulkWrite instead but that also gives the same error. Previously when sending SCPI commands over the LPT I had to add \n after each command. I also tried removing that here, but I get the same error. I would greatly appreciate any suggestions you have. Thank you! Chris Output from usbenum.py: Device: /dev/ugen2.3 Device class: 0 Device sub class: 0 Device protocol: 0 Max packet size: 64 idVendor: 2391 idProduct: 2328 Device Version: 01.00 Configuration: 1 Total Length: 39 selfPowered: 1 remoteWakeup: 0 maxPower: 0 Interface: 0 Alternate Setting: 0 Interface class: 254 Interface sub class: 3 Interface protocol: 1 Endpoint: 0x2L Type: 2 Max packet size: 64 Interval: 0 Endpoint: 0x86L Type: 2 Max packet size: 64 Interval: 0 Endpoint: 0x81L Type: 3 Max packet size: 2 Interval: 1 -- ___ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo___ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users