How to prevent a kernel module from loading? - linux-device-driver

I want to write a module for a usb mouse, so I need to disable the usbhid driver from loading. The thing is it loads again when I connect the mouse. So, how can I disable permanently a module from loading if nothing depends on it?

You may create /etc/modprobe.d/blacklist.conf and put the following line there:
blacklist usbhid
Upon reboot the module will be blacklisted from automatic loading.

Related

After setting READ protection option byte value = CC (chip protection). NO STM32 target found

After setting READ protection option byte value = CC (chip protection) I can't program the card anymore. CubeIDe and CubeProgrammer cannot find the device.
Anyone know how they can fix it thanks
You have permanently disabled debug access on this chip, it can never be restored. That is the whole point and only reason that you would ever write 0xCC.
See the appropriate page in the manual (eg: if you are using stm32f4 then it is section 3.7.3 of RM0090)
This protection level disables debug interface permanently. Your chip is bricked and you need to buy another one.
If your application requires updates you need to write your own bootloader (or the app can upgrade itself) as only the program can reprogram the FLASH in this protection mode.

LIBUSB for FTDI2232 to use I2C mode

Please help me to support this question:
Due to, we have used FTDI2232H and need to use “LIBUSB" to control FTDI2232H.
I want to ask How to control FTDI2232H related programs/code through LIBUSB.
1.To change MPSS mode to interface2?
2.To open iic and init it?
3.To set clock rate & set master mode?
4.The master write I2C code to slave ?
5.The master read I2C code from slave ?
I want to know how to use LIBUSB(libusb_bulk_transfer、libusb_control_transfer) to control FTDI2232H?
Please anyone can help me to solve my problem,I can not get full information from vendor here!!!
You can try this open-source library to talk with the FTDI: https://github.com/lipro/libftdi
Download and unzip it and then just follow the procedure on the README.
Once you finish it, if you are on build you can:
cd examples
make
Now you just load your examples on the terminal like using './'
You can also modify as you want and then remake those examples.

Hololens 2: WinRT information: Only one usage of each socket address (protocol/network address/port) is normally permitted

Background
I am developing an app in Hololens 2 in Unity(2019.3) using :
MRTK Package
HoloLensForCV
I am following the example from ArUcoHololensDetection in Unity. The plan is to add some functionalities after the ArUco tag detection.
I attach the script ArUcoMarkerDetection to a button so that every time this button is clicked the detection starts. Once the tag has been detected, I call another scene with new scripts.
After tag is detected I call StopHoloLensMediaFrameSourceGroup() from the attached ArUcoMarkerDetection which in turn waits till _pvMediaFrameSourceGroup.StopAsync() is completed.
Error
But however, the script runs successfully for the first time, and then when I click the button starts the process again. It does not work and instead I get this error :
Exception thrown at 0x76E4E2AF in Visual Tag Detector.exe: Microsoft C++ exception: Platform::COMException ^ at memory location 0x0234F428.
HRESULT:0x80072740 Only one usage of each socket address (protocol/network address/port) is normally permitted.
WinRT information: Only one usage of each socket address (protocol/network address/port) is normally permitted.
UnityPlayer.Log
Seems to have no issue-related statements at the end. Only stops at :
Stack trace
(I thought to paste the picture as the pointers from the text were interfering with formatting)
The debugger stops at this file excptptr.cpp .
What I tried
Tried to remove PrivateClientServer and InternetClientServer from Capabilities in Player Settings > Publishing settings
Tried to Load the Scene using SceneManager.LoadSceneAsync("SceneName") and SceneManager.LoadSceneAsync("SceneName", LoadSceneMode.Single)
Checked if the new scene is loaded and the old scene is removed as I suspected the old game objects might interfere with the working.
There seems to be some socket-related code at the end of the script ArUcoMarkerDetection, but the app has the same issues with and without this block of code.
Added Microsoft Symbol Servers in Tools>Debugging>Symbols
Added DontDestroyonLoad() on ArUcoMarkerDetection
Continue
If I click on continue when debugging, the issue is gone and the script works and starts detecting other tags.
I am not able to understand where the socket issue is especially coming into the picture as I have not written any socket-related code myself. The only socket related log statements I can check are in the UnityPlayer.Log at the start of the file :
And I cannot check where exactly is the old socket address is being used as it is on Hololens 2, I am not sure if I can check that.
My router does not have multicasting support therefore debugging with Hololens is unfortunately not possible.
I am wondering if anyone faced the same issue and if so how did you solve it?

Include runtime type definitions using VSCode extension

I'm working on a library that lets users run Node processes from inside another application. The library is called "max-api"; functions for sending data to the host application are exposed through a Node module and are loaded in the expected way:
const maxAPI = require("max-api");
However, the user never interacts with this module directly. Rather, when the host application launches the Node process, it intercepts the call to require, checks if the name of the module is "max-api", and provides the module if so.
This works great, the only issue is we have no way to provide type definitions for this modules. So, the user doesn't get any autocomplete or validation for functions in the "max-api" module. I was thinking of writing a VSCode extension to provide these, but I'm not 100% sure how to get started. Thanks in advance for any advice.
You could write a TS typings file (see Definitely Typed). This would be installed in node_modules/#types and vscode will automatically pick it up to provide code completion for your module.

Chroot Multiple Areas

I have chroot set up for "user" with a work area. I am looking to setup another work area on the same machine, and it is fine if you need to exit user, and login as user2 or something. Is this possible to accomplish and if so, how?
I figured out this answer. All that is needed is to add another entry into /etc/schroot/schroot.conf. Once a linux skeleton is built in there, using debootstrap, then you can chroot into the area without issues!