Chrome app fails to open usb device - google-chrome

I'm trying to connect to a smartcard reader form a chrome app using chrome.usb. The permissions in the manifest are set properly and lsusb recognizes the device.
chrome.usb.getDevices detects the device but when I try to open it using chrome.usb.openDevice I get "Failed to open device". I've tried it on both windows 7 with chrome 43 and ubuntu with chrome 42 and got the same result. I've also installed chrome device-info sample app and got the same message.
Is there anything I should be looking at on the device itself? Could it be related to permissions?

First you need to figure out the vendor and product IDs for your device. If you run lsusb it will list the devices on your system in a format like this:
~$ lsusb
Bus {Bus number} Device {device id}: ID {vendorid in hexa}:{product id in hexa} Manufacturer Product
Once you know this information you can create a file in /etc/udev/rules.d/ with the name {deviceid}.rules. Replace {deviceid} with the value obtained from the output up there.
The content should be the following:
SUBSYSTEM=="usb", ATTRS{idVendor}=="vendorid", ATTR{idProduct}=="productid", MODE="0666", GROUP="plugdev"
Replace vendorid and productid with corresponding hexadecimal values obtained by running the command above.

News? I found in chrome://device-log/ the message :
usb_device_impl.cc:259 Failed to open device: Access denied (insufficient permissions)

Related

How to force Chrome to always open as application without command line or shortcut

How are you?
I hope you are safe and sound.
I was wondering how can edit the Windows 10 in order to make chrome/edge to always open always open as the following flags:--app and -userdatadir=C:/temp
Don't want via shortcut or command line.
Thanks.
From your previous comment, I understand that you want to set the User Data Directory using the registry key for the MS Edge Chromium browser.
Here, I am showing you 2 approaches. Using registry key and using group policy.
Below are the steps to set the User Data Directory using the registry key.
Open Registry editor.
Browse to the location below.
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge
Create a new string value and name it as UserDataDir.
Doubble click on it and set the directory value.
Close the Registry editor and relaunch the MS Edge browser.
Below are the steps to set the User Data Directory using the Group policy.
Open Local group policy editor.
Browse to the location below.
Computer configuration -> Administrative templates -> Microsoft Edge
Find and double click on Set the user data directory policy.
Click on enabled option and then set the desire value.
Close the Local group policy editor and relaunch the MS Edge browser.
Reference:
Create Microsoft Edge user data directory variables

Autohotkey: Identify Google Chrome vs Google Chromium

I can't seem to figure this out
On autohotkey, there's documentation on how to identify a window / program running.
Google Chrome and Google Chromium both use the same ahk_class and the same .exe name of chrome.exe
How does one use something like winTitle or winGet to distinguish the difference? I tried looking into PID values but they don't seem to be consistent.
EDIT via WinSpy++
Using winspy++, I ran a simple experiment. 2 Chromium Windows and 2 Chrome Windows so I can have a control group. Differences:
INSTANCE HANDLE: Chrome shows 0F2C0000, Chromium shows A2820000
Process ID: Chrome shows 00003528 (13608), Chromium shows 00001B74 (7028)
Thread ID: Chrome shows 00003524 (13604), Chromium 00000220 (544)
In this case you have two possibilities to distinguish between the two programs:
(1) Using SetTitleMatchMode 2 and the part of the title that all windows of this program have in common:
SetTitleMatchMode 2
If WinExist("- Chromium")
WinActivate
(2) Using "ahk_exe Path":
If WinExist("ahk_exe full_path_of_the_executable_chrome.exe")
WinActivate
To get the full path of the active window process use this:
F1::
WinGet, Path, ProcessPath, A
MsgBox, %Path%
return
Using Windows Spy (came with autohotkey). Is not the same as winspy++
To access Windows Spy found here:
Differences are found in WinTitle

chrome "aw, snap" crash, but can't see crash log in chrome://crashes but see DMP generated, so what is the quickest way to interpret this DMP file

I can see my page get crash(see aw, snap page) with 20% proprobility after 10 mins(otherwise it runs well like forever)
so I tried:
1) CPU and memory check with task manager, and see no increasing(so no leakage).
2) enable crush log in the chrome://settings/
result:
2.1) see still nothing in the chrome://crashes page, not even a crush ID (0 crashes).
2.2) see nothing in the folder under path
C:/%User%/AppData/Local/Google/CrashReports (nothing in) nor
C:/%User%/AppData/Local/Google/Chrome/User Data/Crash Reports (folder not exist)
2.3) but indeed see DMP in the:
C:/%User%/AppData/Local/Google/Chrome/User Data/CrashPads/reports
but seems they are not readable, and it also seems not the correct address for crash logs
3) can get chrome log either by command line arguments, or using sawbuck, but found nothing but only 2 errors, one for sawbuck itself, and another saying can't send the report to google.
So the questions are:
1) are those DMP the crash logs(the default Dir for dump file has been changed for chrome v50)
2) how can I abstract information out of the DMP file, if chrome://crashes page shows nothing (for chrome on windows)
p.s. 2 usage pages are found at https://www.chromium.org/developers/decoding-crash-dumps
https://www.chromium.org/developers/crash-reports
but seems it's not for windows without a recompile of chrome's component, is there any 3rd party tools to interpret the DMP file?
env informations:
chrome version: 50.0.2661.02 m
; Host OS: windows 10
The crash dumps (.dmp files) in C:\Users\<user>\AppData\Local\Google\Chrome\User Data\Crashpad\reports can be read by standard Windows debuggers. WinDbg is one tool (provided by Microsoft) for analysing these dumps; it's not going to win any beauty contents, but it's powerful and gets the job done. The recommended way to obtain it is, somewhat bizarrely, the Windows Driver Kit.
You'll need debugging symbols to make sense of the results, and these aren't included in standard builds of Chrome. To get symbols for both Chrome and the Windows runtime, set the following as your Symbols path:
SRV*c:\symbols*https://msdl.microsoft.com/download/symbols;SRV*c:\symbols*https://chromium-browser-symsrv.commondatastorage.googleapis.com
There are numerous resources on using WinDbg on the web; this cheat sheet contains some useful commands to get you started.

IIS6 + Mercurial, 404 when browsing repositories

Sorry for the cross-post, but I received no answer at serverfault.
I've set up a Mercurial server on a Win2k3 box with IIS6, using hgwebdir_wsgi, and it does seem to work until the point where I can see a nice list of my repositories in a browser, but if I try to browse any of them (that is, I click the name of the repo), then I get a 404 error.
Any ideas about what I might be doing wrong? What log files or whatever should I check (I'm kinda new to IIS)? Thanks.
--
Some update:
The actual error code in the IIS logs is 404.0.2. A win32 error code of 2 simply means "file not found".
The event viewer is full of ISAPI errors like these:
The description for Event ID ( 4097 ) in Source ( ISAPI Filter or Extension ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: Factory function '__FilterFactory__' failed, n/a.
Could not load all ISAPI filters for site/service. Therefore startup aborted.
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
The description for Event ID ( 4096 ) in Source ( ISAPI Filter or Extension ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: Filter version function failed!, n/a.

Using --js-flags in Google Chrome to get --trace output

I've looked through various sources online and done a number of Google searches, but I can't seem to find any specific instructions as to how to work with the V8 --trace-* flags in Google Chrome. I've seen a few "You can do this as well in Chrome", but I haven't been able to find what I'm looking for, which is output like this: (snippets are near the near bottom of the post) Optomizing for V8.
I found reference that the data is logged to a file: Profiling Chromium with V8 and I've found that the file is likely named v8.log: (Lost that link) but I haven't found any clues as to how to generate that file, or where it is located. It didn't appear to be in the chrome directory or the user directory.
Apparently I need to enable .map files for chrome.dll as well, but I wasn't able to find anything to help me with that.
The reason I would prefer to use Chrome's V8 for this as opposed to building V8 and using a shell is because the JavaScript I would like to test makes use of DOM, which I do not believe would be included in the V8 shell. However if it is, that would be great to know, then I can rewrite the code to work sans-html file and test. But my guess is that V8 by itself is sans-DOM access, like node.js
So to sum things up;
Running Google Chrome Canary on Windows 7 ultimate x64
Shortcut target is "C:\Users\ArkahnX\AppData\Local\Google\Chrome SxS\Application\chrome.exe" --no-sandbox --js-flags="--trace-opt --trace-bailout --trace-deop" --user-data-dir=C:\chromeDebugProfile
Looking for whether this type of output can be logged from chrome
If so, where would the log be?
If not, what sort of output should I expect, and again, where could I find it?
Thank you for any assistance!
Amending with how I got the answer to work for me
Using the below answer, I installed python to it's default directory, and modified the script so it had the full path to chrome. From there I set file type associations to .py files to python and executed the script. Now every time I open Chrome Canary it will run that python script (at least until I restart my pc, then I'll have to run that script again)
The result is exactly what I was looking for!
On Windows stdout output is suppressed by the fact that chrome.exe is a GUI application. You need to flip Subsystem field in the PE header from IMAGE_SUBSYSTEM_WINDOWS_GUI to WINDOWS_SUBSYSTEM_WINDOWS_CUI to see what V8 outputs to stdout.
You can do it with the following (somewhat hackish) Python script:
import mmap
import ctypes
GUI = 2
CUI = 3
with open("chrome.exe", "r+b") as f:
map = mmap.mmap(f.fileno(), 1024, None, mmap.ACCESS_WRITE)
e_lfanew = (ctypes.c_uint.from_buffer(map, 30 * 2).value)
subsystem = ctypes.c_ushort.from_buffer(map, e_lfanew + 4 + 20 + (17 * 4))
if subsystem.value == GUI:
subsystem.value = CUI
print "patched: gui -> cui"
elif subsystem.value == CUI:
subsystem.value = GUI
print "patched: cui -> gui"
else:
print "unknown subsystem: %x" % (subsystem.value)
Close all Chrome instances and execute this script. When you restart chrome.exe you should see console window appear and you should be able to redirect stdout via >.
If your not keen on hacking the PE entry of chrome then there is alternative for windows.
Because the chrome app doesn't create a console stdout on windows all tracing in v8 (also d8 compiler) is sent to the OutputDebugString instead.
The OutputDebugString writes to a shared memory object that can be read by any other application.
Microsoft has a tool called DebugView which monitors and if required also stream to a log file.
DebugView is free and downloadable from microsoft: http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx