How to block USB storage device using EndPoint Security? - objective-c

I am working on EndPoint Security. I was trying to control and block the USB storage device using the same. I used the event ES_EVENT_TYPE_AUTH_IOKIT_OPEN.
How can I get info about the device? for instance: Name Vendor Type etc...
Also when I just tried to block all the devices in the IOkit by just returning ES_AUTH_RESULT_DENY, still I was able to access the USB storage device after running the code in terminal. Could anyone guide and tell me what am I missing or where am I getting wrong?

Related

Error in making my own usb stack for stm32f4

actually I am on the path of learning usb . so I want to make my own usb stack for stm32f4 mcu. But I got stuck at one point . actually the problem is my framework layer accept and recognise the control request and the request is get descriptor but the wlength is 64 bytes instead of 18(size of device descriptor). And also I transfer the data to in endpoint 0 but the usb host never send the in token after the setup stage completion instead the setup stage is called again and after windows show the prompt message not able to recognise the device
Please help me what is that I am missing in my framework

Usb hub stalls when asking for descriptors

I have started with an Atmel Start project:
My goal is to have a usb hub connected to this demo board:
SAM V71 Xplained Ultra Evaluation Kit
The problem is atmel doesn't supply a hub driver, and they haven't responded to our questions about this. So I have been attempting to write one based upon the msc and other drivers they do provide.
Currently I'm having an issue when I connect the USB hub. It is returning a STALL when I send a GET_DESCRIPTOR request with the type DEVICE. This seems odd to me because other USB devices such as a flash drive or USB to serial converter do not reply STALL to the same request. In fact the Flash drive goes through the entire enumeration process and msc installation so that I can successfully read and write to the drive.
I am detecting the stall via a single break point set in the STALL handling section of the pipe handler.
I have been reading the Universal Serial Bus
Specification Rev 2.0 but I can't find any differences between the way to read descriptors from hubs vs other devices. And I don't understand why a STALL would ever be sent in reply to a GET_DESCRIPTOR request.
Thanks
Just in case this is useful for anyone else. The issue I was having was apparently caused by the compiler optimization settings. Specifically I had change this setting to: "None (-O0)", after changing this back to the default I have had no problems enumerating USB devices. Picture of Optimization configuration
My colleague discovered this because of a seemingly unrelated problem which was causing Hard faults and Bus faults on the chip, these were also fixed by switching back to -O1. It seems -O0 needs to be used with a grain a salt or not at all on this chip.

What is the exact function of an USB driver?

On reading many websites, I got confused.
Is the USB driver essential for making the device work? Or is it essential for making it communicate with the OS to do functions such as printing and doing other OS stuff?
To explain my question more clearly -
I am working on developing a USB device, that will communicate with the software i will write.
Do I need to develop a driver for such a system?
or
Do I just need the software program to send the proper messages to the device?
I am assuming your micro controller will be a USB device and your PC will be USB host.
The below diagram is the SW architecture for USB host. Now since your host is a PC, you do not need to worry about any part except the application at the top.
So lets talk about the device. What you need is a device stack which resembles with the host stack below. You can get the device stack easily and port it in your micro controller. But I suppose you need an application in your device too same as the top box of the below diagram which will understand the requests from the host and service the request.
So basically what I am saying that you need two applications and the rest of the components you can get it with some effort.
Regards.

How to know the information of USB endpoints?

How can I determine the number and type of endpoints(control - IN/OUT,interrupt-IN/OUT?) my USB device is having.DOes it differs if I plug the same device onto different hosts(Linux,Windows,Mac)
You could use libusb. It runs on all of those platforms and it has functions for retrieving the configuration descriptor from the device. You could then parse the configuration descriptor to figure out how many endpoints there are.
Or you could just run lsusb -v, which will show you tons of information about your device.

Get type of device inserted to windows 8 pc via USB port

I've been asked to work on a project for Windows 8 where I have to detect:
Type of device inserted to USB port (mass storage drive or android phone or windows phone etc.)
Port in which device was inserted. (if I have 4 USB ports in PC then identify which port received new device)
Detect when the device was ejected from the PC
Are there some managed C# API's that can be used to query or if there are some callbacks that can be subscribes to.
Any help or direction will be very useful.
Thanks
You don't specify whether you are writing a desktop app, or a Modern UI app. If it is the latter, I'm afraid you are going to be out of luck as this level of information is simply not passed down to the app's sandbox.
You may have better luck with a desktop app. I don't have any direct experience of doing what you ask for, but I do remember having read that it may be possible through .NET.