Can I use a USB pen drive with libusbdotnet - libusb

I have just started on libusbdotnet. I have downloaded the sample code from http://libusbdotnet.sourceforge.net/V2/Index.html.
I am using a JetFlash 4GB Flash drive (a libusb-win32 filter driver was added for this drive).
The ShowInfo code works perfectly, and I can see my device info with two endpoints. Following is the device info from pastebin
http://pastebin.com/2Jdph6bY
However, the ReadOnly sample code does not work.
http://pastebin.com/hNZaEt8N
My code is almost same as that from the libsubdotnet website. I have only changed the endpoint that UsbEndpointReader uses. I have changed it from Ep01 to Ep02, because I read that the first endpoint is a control endpoint used for configuration, access control and similar stuff.
UsbEndpointReader reader = MyUsbDevice.OpenEndpointReader(ReadEndpointID.Ep02);
I always get the message "No more bytes!".
I thought that this is because of the absence of data, so I used the ReadWrite sample code.
http://pastebin.com/NiN5w9Jt
But here I also get "No more bytes!" message.
Interestly, the line
ec = writer.Write(Encoding.Default.GetBytes(cmdLine), 2000, out bytesWritten);
executes without errors.
Can pen drives be used for read write operations? Or is something wrong with the code?

A USB thumb drive implements the USB mass storage device class, which is a subset of SCSI. The specification is here.
You're not going to get anything sensible by just reading from an endpoint - you have to send the appropriate commands to get any response.
You have not chosen an easy device class to begin your exploration of USB - you may be better starting with something easier - a HID class device, perhaps (Mouse/Keyboard) though Windows does have enhanced security around mice and keyboards which may prevent you installing a filter.
If you meddle with the filesystem on the USB stick while it's mounted as a drive by Windows, you'll almost certainly run into cache-consistency problems, unless you're extremely careful about what kind of access you allow Windows to do.

Related

Configure .eds file to map channels of a CANopen Client PLC

In Order use a PLC as a Client (formerly “Slave”), one has to configure the PDO channels, since the default values of the manufacturer are often not suitable. In my case, I need the PDOs so send INT valued instead of the default UNSIGNED8 (see. Picture).
Therefore my question: What kind of workflow would you recommend, to map the CANopen Client PDO channels?
I found the following workflow suitable, however I appreciate any improvements and recommendations from your side!
Start by locating the .eds file from the manufacturer. The image show this in the B&R Automation Studio Programming Environment
Open the file in a eds. Editor. I found the free Vector CANEds Editor very useful. Delete all RxPODs and RxPDO mappings that you don’t need.
Assign the needed Data Type (e.g. INTEGER16) and Channel Name (“1 Byte In (1)”).
Add the necessary PDOs and PDO mapping from the database. (This might actually be a bug, but if you just edit the PDOs without deleting and recreating them, I always receive error messages)
Map the Date to the Channels
Don't forget to write the number of channels in the first entry (in this image: 1601sub0)
Check the eds file for Errors (press F5) and copy&paste the eds file to the original location point 1.)
Add the PLC Client device in Automation Studio and you should see the correct mappings.
(PS: I couldn't make the images smaller ... any recommendations about formating this question are welcome!)

omnet++ Inet - Simulating dynamic access point behaviour

I have to create a particular simulation for a college project. The simulation should feature several mobile nodes cyclically switch between 802.11 access point and station modes. While in station mode, nodes should read the SSIDs of access points around them, and then they should change their SSID in AP mode accordingly. There is no need for connections or data exchange between the nodes beside the SSID reading.
Now, I've been through Omnet/Inet tutorials/documentation (all two of them), and I feel pretty much stuck.
What I could use right now is someone confirming my understanding of the framework giving me some directions on how exactly I should proceed.
From what I understand is Inet does not implement any direct/easy way to do what I'm trying to do. Most examples have fixed connections declared in NED files and hosts with a fixed status (AP or STA) defined in the .ini file.
So my question is basically how do I do that: do I need to extend a module (say, wirelessHost), modifying its runtime behaviour, or should I implement a new application (like UDPApp) to have my node read other SSIDs and change his accordingly? And what is the best way to access an host's SSID?
You may utilize two radios for each mobile node e.g. **.mobilenode[*].numRadios = 2 (see also example in /inet/examples/wireless/multiradio/).
The first radio operates as AP **.mobilenode[*].wlan[0].mgmtType = "Ieee80211MgmtAPSimplified" which has to adapt its SSID.
The second radio serves as STA **.mobilenode[*].wlan[1].mgmtType = "Ieee80211MgmtSTA". Now, you have to sub-class Ieee80211AgentSTA which handles the SSID scanning procedure and has to change the first radio's SSID upon new SSID detection. Then you utilize the adopted sub-class within the simulation. Finally, active scanning has to be activated **.mobilenode[*].wlan[1].agent.activeScan = true.

Monitor process api calls windows 7 vb.net/C# or C++

Currently i'm working on a security monitoring app that continuously monitor new processes created.
For that im using wim and event watcher, witch works fine in VB.NET.
But there are 2 features that im missing.
I need to monitor process API calls, and I've been searching the web like mad, and come up empty.
Basically i need to monitor process WaitForSingleObject, LoadLibraryA, CreateProcessW and WriteProcessMemory. And registry access/changes as well.
Im hoping this can be done without a system wide hook, but form what i can find, it cannot be done via WMI.
So the question is, how to, and what can i do with managed code.
I'm gonna focus on the second point as i don't have experience on your first.
For checking if a process is signed i am using the sigcheck.exe from Mark Russinovich, because of the various methods it uses to verify files. Some are catalogsigned, some have the key embedded, there is iirc another weird method. There is no easy way to do it yourself. Had weird false detections with trying self-built methods to cover all possibilities. Hope that info helps

How to use the USB/HID port with objective-c under a Mac environment

I try to implement an application in snow Leopard, Reading Data from USB/HID device.In my application i tried following steps:
IOHIDManagerCreate()
CreateDeviceMatchingDictionary()
IOHIDManagerSetDeviceMatching()
IOHIDManagerOpen()
IOHIDManagerCopyDevices()
Create a Reference for device(IOHIDDeviceRef)
Based On the IOHIDDeviceRef i Fetch device details such as(Device ProductIDKey, Device VendorIDKey,Device ProductKey,Device Serial NumberKey,Device VersionNumberKey ect.)
IOHIDDeviceOpen(),ie :Using IOHIDDeviceRef i opened Device;
IOHIDDeviceCopyMatchingElements(); Ie Copy Matching Elements from the Device;
Create a Reference element(ie IOHIDElementRef);
Using IOHIDElementRef i retrieved Device Usage,Device Cocookie,Device UsagePage etc.
Up to this My application working Fine.
My doubts are
How can read data From Endpoint 1, My device is special purpose device having only one End point(Interrupt no synchronization data end point)?
Is their any Pipe associated with end point 1(HID Device)?;
Is their any ReadPipe and WritePipe functions in HIDManager Based Application?
Is it possible to retrieve data from USB/HID using IOHIDDeviceSetReoprtWithCallback()?
Every thing Did based on this Link:
http://developer.apple.com/library/mac/#documentation/DeviceDrivers/Conceptual/HID/new_api_10_5/tn2187.html#//apple_ref/doc/uid/TP40000970-CH214-SW7 ...
Thank you so much for your help ..
You are trying to use HID functions with non-HID device.
HID is Human Interface Device. Any HID device must conform "Device Class Definition for HID".
I suspect, your device does not conforms this specification.
So you should use other OS interface to work with your device. I suggest to use libusb. This is cross-platform library for working with USB devices on low level. It will allow you to read/write your endpoint directly.

VB.NET - Set windows to control/manage wireless over third-party clients

Within VB.NET, trying to find an easy way to in a sense check the check-box "Use Windows to configure my Wireless Network Settings". This is an option that forces windows to use your wireless over third-party programs that may try to steal control. I am aware this requires to have WZC enabled within services and that's something that can be easily accomplished one way or another.
I doubt or rather cannot find a proper registry value or API call to check or initiate such a task.
I would use a registry-recorder to record the changes when manually changing the value, then its a piece of cake to implement the register change in code.
There are plenty programs that can be used to see what changes has been done in the registry, here are one free: http://www.kephyr.com/systemsherlocklite/index.phtml, but google may find more or better variants out there.
With this tool, create a registry dump:
systemsherlock.exe -dump d1.dat -regdirs HKEY_ROOT
Do the change in the wireless network settings
Do a new dump of the registry:
systemsherlock.exe -dump d2.dat -regdirs HKEY_ROOT
And last, compare them and see what has changed:
systemsherlock.exe -compare d1.dat d2.dat