允许Web套接字的content-security-policy元标记(content-security-policy meta tag for allowing web socket)

情况:由content-security-policy元标记阻止的phonegap serve的自动phonegap serve

添加内容安全策略可防止自动重新加载phonegap serve实用程序。 这是建立在cordova serve之上,但在文件编辑时自动重新加载应用程序。 它的工作原理是在index.html注入socket.io 。 我应该在我的CSP元标记中指定哪些内容允许套接字连接到我的笔记本电脑。

这是我目前的CSP元标记:

<meta http-equiv="Content-Security-Policy" content="default-src 'self' 192.168.0.100 * ws:* ; connect-src ws://192.168.0.100 ws:*"> 

但是在打开时,设备会一直显示“正在连接到设备”,而不会在设备上收到事件。

另请注意,它开始处理删除此元标记,这意味着cordova-plugin-whitelist可能无法阻止它。


Situation: autoreload of phonegap serve blocked by content-security-policy meta tag

Adding content security policy prevents auto-reload of phonegap serve utility. This is built on top of cordova serve but auto-reloads the app on file editing. It works by injecting socket.io in index.html. What should I specify in my CSP meta tag that will allow socket connections to my laptop.

Here is my current CSP meta tag:

<meta http-equiv="Content-Security-Policy" content="default-src 'self' 192.168.0.100 * ws:* ; connect-src ws://192.168.0.100 ws:*"> 

However on opening, the device keeps showing "Connecting to device" and not event is received on the device.

Also note that it starts working on removing this meta tag which mean the cordova-plugin-whitelist might not be blocking it.


原文:https://stackoverflow.com/questions/32986074
2022-02-17 09:02

满意答案

事实证明,这些设备使用标准的Silicon Labs CP2102接口芯片,设备制造商加载了自定义idProduct编号。 虽然芯片与cp210x.ko驱动程序100%兼容,但系统无法识别idProduct ,也不会将驱动程序与其关联。

此时,有几种可能的解决方案:

  • 手动指示系统将cp210x.ko驱动程序与此idProduct一起使用。
  • idProduct添加到开源驱动程序 ,编译并安装它。 然后尝试将更改推送到标准Linux存储库。
  • 用通用芯片替换定制芯片。
  • 重写芯片上的idProduct

我选择重写idProduct 。 Silicon Labs有一个免费的实用程序可以做到这一点。 我设置了idProduct=EA60 ,这是该芯片的默认设置。 该设备现在可以通过标准内置驱动程序识别,并且工作正常。


It turns out this devices uses a standard Silicon Labs CP2102 interface chip, which the device manufacturer loaded with a custom idProduct number. While the chip is 100% compatible with the cp210x.ko driver, the idProduct is not recognized by the system, and does not associate the driver with it.

At this point, there are several possible solutions:

  • Manually direct the system to use the cp210x.ko driver with this idProduct.
  • Add the idProduct to the open source driver, compile, and install it. Then try to push the changes into standard Linux repositories.
  • Replace the customized chip with generic one.
  • Rewrite the idProduct on the chip.

I chose to rewrite the idProduct. Silicon Labs has a free utility to do just this. I set the idProduct=EA60, which is the default for this chip. The device is now recognized by the standard built-in driver, and works perfectly.

相关问答

更多

t420 integrated camera linux 摄像头在什么地方下载呀

您好,由于目前消费电脑大部分的驱动以及应用程序都是在windows 操作系统下开发的,还没有针对linux 系统的驱动程序,为了您电脑的正常运行,我们建议您使用windows 系统;如果您由于工作或学习需要,安装使用linux 系统,您可以到相关的专业论坛、网站上搜索相应设备的驱动程序。

适用于Linux的虚拟串行端口(Virtual Serial Port for Linux)

您可以使用pty(“伪电传”,其中串口是“真实电传”)。 从一端打开/dev/ptyp5 ,然后将程序附加到/dev/ttyp5 ; ttyp5将像串行端口一样执行,但将通过/ dev / ptyp5发送/接收它所做的一切。 如果真的需要它与一个名为/dev/ttys2的文件进行/dev/ttys2 ,那么只需将旧的/dev/ttys2从ptyp5转到ttys2 。 当然你可以使用ptyp5以外的其他ptyp5 。 也许选择一个高数字以避免重复,因为所有的登录终端也将使用ptys。 维基百科有更多...

Linux上的Cygnal Integrated Products串口(Cygnal Integrated Products serial port on Linux)

事实证明,这些设备使用标准的Silicon Labs CP2102接口芯片,设备制造商加载了自定义idProduct编号。 虽然芯片与cp210x.ko驱动程序100%兼容,但系统无法识别idProduct ,也不会将驱动程序与其关联。 此时,有几种可能的解决方案: 手动指示系统将cp210x.ko驱动程序与此idProduct一起使用。 将idProduct添加到开源驱动程序 ,编译并安装它。 然后尝试将更改推送到标准Linux存储库。 用通用芯片替换定制芯片。 重写芯片上的idProduct ...

linux中的串口(raspbian)(serial port in linux (raspbian))

在我的头顶,它是 stty -F /dev/ttySX raw -echo -echoe -echok -echoke 从手册页中可能会有更多标志: [-]crterase echo erase characters as backspace-space-backspace * crtkill kill all line by obeying the echoprt and echoe settings * -crtkill ...

Linux串口优先级(Linux serial port priority)

尝试使用setserial设置low_latency选项。 默认情况下,串行端口针对吞吐量而非延迟进行了优化,我认为此选项可让您更改它。 Try the using setserial to set the low_latency option. By default serial ports are optimised for throughput not latency, this option I think lets you change it.

Linux - 与C的多串口通信(Linux - Multiple Serial Port Communication with C)

你是如何获得第一个串口的文件描述符的? 假设它是这样的: fd = open("/dev/serialPort0", O_RDWR); 你应该能够做到: fd2 = open("/dev/serialPort1", O_RDWR); 并获取用于其他串行端口的文件描述符。 写下你想要的每一个: char str1[] = "Hello, port 1!\n"; char str2[] = "hello, port 2!\n"; write(fd, str1, sizeof str1); wri...

Linux - 与设备关联的端口(Linux - port associated to a device)

我的问题是我不知道应该如何理解我应该监视哪个串口。 如果这个“一个开发板”被Linux PC识别为USB小工具,则会有syslog条目。 断开电路板,等待15秒,然后连接电路板。 使用命令dmesg | tail dmesg | tail来检查syslog的结尾。 你可能得到这样的东西: $ dmesg | tail [ 2094.481014] usb 1-1: Product: EDBG CMSIS-DAP [ 2094.481019] usb 1-1: Manufacturer: Atmel...

如果我使用串口控制台登录linux,是使用terminfo还是termcap?(If I login linux using serial port console, does it using the terminfo or termcap?)

没什么区别。 一些系统可能会为某些应用程序使用termcap 库 (offhand,可能只有Slackware),但是应用程序使用相同的库,无论它是否在串行端口上运行。 有几个应用程序使用termcap 接口来访问ncurses库(它提供了termcap和terminfo接口),但这并没有改变答案。 他们仍然会使用相同的库(和相同的接口),因为在同一个库的不同低级接口之间切换几乎没有意义。 “接口”当然是指用于初始化和查询终端数据库的少数功能。 使用termcap 接口到ncurses的应用程序仍...

Linux上的软件串口环回(Software serial port loopback on linux)

不幸的是,现代伪终端并不那么容易。 在使用posix_openpt()或open("/dev/ptmx")主posix_openpt()之后,必须在主服务器及其相应的从服务器可用之前调用grantpt()和unlockpt() 。 ( openpty()等实用程序函数简化了这一点。) 作为一种解决方法,可以使用方便的社交场所 。 # terminal 1 socat pty:link=$PWD/pts unix-l:$PWD/ptm-pipe & dynamips -U $PWD/pts # t...

在Qt中选择串口(Linux)(Selecting serial port in Qt(Linux))

您可以使用QSerialPort port("/dev/ttyUSB0")构造串行端口对象。 此QSerialPort构造函数接受它在QSerialPortInfo::portName()存在的形式的端口名称。 没有记录这个名称是"/dev/ttyUSB0"形式,但似乎是这样。 You can construct a serial port object using QSerialPort port("/dev/ttyUSB0"). This QSerialPort constructor acc...

相关文章

更多

关于微信公众号内嵌网页的几个meta标签

最近在做微信公众平台内嵌app,其实也就是web app=&quot;=,不过就是基于微信内置浏览器( ...

Web scraper open source

ByadminOnSeptember 10, 2012&middot;Add Comment ...

HTML meta标签

meta标签 :属性标签 . 网页元标签 &lt;meta http-equiv=&quot;Con ...

JAVA WEB

我也搞了几年JAVA了,由于一向懒惰,没有成为大牛,只是一普通程序猿,不爱玩社交网站,不爱玩微博,唯独 ...

修改Linux Socket最大连接数

修改Linux Socket最大连接数有两种方法: 1、ulimit -n 5000 把允许最大打开的 ...

微信公众平台如何与Web App结合?

Web App简而言之就是为移动平台而优化的网页,它可以表现得和原生应用一样,并且克服了原生应用一些固 ...

微信公众平台如何与Web App结合?

Web App简而言之就是为移动平台而优化的网页,它可以表现得和原生应用一样,并且克服了原生应用一些固 ...

3年swing,1年JavaEE,1年java socket转android什么待遇

3年swing,技能除了跟做游戏的比足够了。做过IM 3款,手术X光机客户端1款,线程是我的强项,过度 ...

HTML5 Web SQL Database 数据库

Web SQL数据库API实际上不是HTML5规范的组成部分,而是单独的规范。它通过一套API来操纵客 ...

最新问答

更多

获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)

我用Google搜索了一个解决方案。 “EnumDisplayModeProvider”是我自己设置网站的各种模式的枚举。 public EnumDisplayModeProvider GetDisplayModeId() { foreach (var mode in DisplayModeProvider.Instance.Modes) if (mode.CanHandleContext(HttpContext)) {

如何通过引用返回对象?(How is returning an object by reference possible?)

这相对简单:在类的构造函数中,您可以分配内存,例如使用new 。 如果你制作一个对象的副本,你不是每次都分配新的内存,而是只复制指向原始内存块的指针,同时递增一个也存储在内存中的引用计数器,使得每个副本都是对象可以访问它。 如果引用计数降至零,则销毁对象将减少引用计数并仅释放分配的内存。 您只需要一个自定义复制构造函数和赋值运算符。 这基本上是共享指针的工作方式。 This is relatively easy: In the class' constructor, you allocate m

矩阵如何存储在内存中?(How are matrices stored in memory?)

正如它在“熵编码”中所说的那样,使用Z字形图案,与RLE一起使用,在许多情况下,RLE已经减小了尺寸。 但是,据我所知,DCT本身并没有给出稀疏矩阵。 但它通常会增强矩阵的熵。 这是compressen变得有损的点:输入矩阵用DCT传输,然后量化量化然后使用霍夫曼编码。 As it says in "Entropy coding" a zig-zag pattern is used, together with RLE which will already reduce size for man

每个请求的Java新会话?(Java New Session For Each Request?)

你是如何进行重定向的? 您是否事先调用了HttpServletResponse.encodeRedirectURL()? 在这里阅读javadoc 您可以使用它像response.sendRedirect(response.encodeRedirectURL(path)); The issue was with the path in the JSESSIONID cookie. I still can't figure out why it was being set to the tomca

css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)

我认为word-break ,如果你想在一个单词中打破行,你可以指定它,这样做可以解决问题: .column { word-break:break-all; } jsFiddle演示。 您可以在此处阅读有关word-break属性的更多信息。 I think word-break, with which you can specify if you want to break line within a word, will do the trick: .column { word-break

无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)

我认为您忘记在分类时间内缩放输入图像,如train_test.prototxt文件的第11行所示。 您可能应该在C ++代码中的某个位置乘以该因子,或者使用Caffe图层来缩放输入(请查看ELTWISE或POWER图层)。 编辑: 在评论中进行了一次对话之后,结果发现在classification.cpp文件中错误地删除了图像均值,而在原始训练/测试管道中没有减去图像均值。 I think you have forgotten to scale the input image during cl

xcode语法颜色编码解释?(xcode syntax color coding explained?)

转到: Xcode => Preferences => Fonts & Colors 您将看到每个语法高亮颜色旁边都有一个简短的解释。 Go to: Xcode => Preferences => Fonts & Colors You'll see that each syntax highlighting colour has a brief explanation next to it.

在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)

你考虑过第三方拼写检查吗? 您可以将在C#中开发的自定义WinForms控件插入访问数据库吗? VB6控件怎么样? 如果你能找到一个使用第三方库进行拼写检查的控件,那可能会有效。 Have you considered a third party spell checker? Can you insert a custom WinForms controls developed in C# into an access database? What about a VB6 control? If

从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)

我有同样的问题,因为我在远程服务器上有两个图像,我需要在每天的预定义时间复制到我的本地服务器,这是我能够提出的代码... try { if(@copy('url/to/source/image.ext', 'local/absolute/path/on/server/' . date("d-m-Y") . ".gif")) { } else { $errors = error_get_last(); throw new Exception($err

从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))

我不确定我完全明白你在说什么。 你能编辑你的帖子并包含你正在做的Subversion命令/操作的特定顺序吗? 最好使用命令行svn客户端,以便容易为其他人重现问题。 如果您只是想获取文件的旧副本(即使该文件不再存在),您可以使用如下命令: svn copy ${repo}/trunk/moduleA/file1@${rev} ${repo}/trunk/moduleB/file1 其中${repo}是您的存储库的URL, ${rev}是您想要的文件的版本。 这将恢复该文件的旧版本,包括最高版本