Author Topic: Experiencing reading to and writing from a USB device, e.g. a mouse or trackball  (Read 3347 times)

Henny Barten

  • Newbie
  • *
  • Posts: 32
    • View Profile
Hi, I'm evaluating if nrComm is the right tool for me for writng Delphi7 applications on a Windows 7 platform.
If so, I certainly will buy it.
To get familiar I decided as first experiment to see if I can monitor mouse messages. It's a Logitech trackball and it is recognized in all available nrComm USB demos and the available properties can be shown. But when I try to open the device (e.g. in usbosrkitdemo_winusb) it fails. Installing the driver fails also as I keep getting the message that access is refused while I'm sure that I do have the administrator rights. I found in this forum the following advice: "You need open demo sources and change IdVendor and IdProduct values on correct numbers of your device." So in the Object Inspector I changed the idProduct and IdVendor, but nothing helps solving my problem.

Another issue is that to my opinion the help information is very poor regarding the nrComm USB components.

Please give me some useful hints such that I can get my USB applications running.

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Hello

Thank you for your interest in our product.

Unfortunately mouse is not good choice for experiments. Windows recognizes it as HID and uses it as pointer device and loads standard system driver.

Possible you can try something else like USB modem, USB-to-rs232 adapter and etc.

Yes, documentation is pitiful. We are working on for improve it.
You can search info in this forum and ask your questions. We will try to help you.

Also please note that you need to learn some USB specific features before try to work.
You should understand pipes id, pipes directions and etc.
You need know more details (specification) about your target USB device.

Please You need make full tests trial nrComm Lib before, decide to spend your money for purchasing license.

Roman Novgorodov
DeepSoftware LLC
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

Henny Barten

  • Newbie
  • *
  • Posts: 32
    • View Profile
Hi Roman,

Today I tried USBDriverDemo on my Sweex USB-to-rs232 adapter and also on a USB memory stick but keep having the same problem which is installing WinUsb while I'm 100% sure that I'm adminstrator. I'm working on Windows7 and tried the same thing on another Windows7 computer, also 100% sure as administrator but without any success. Are you 100% sure that installing WinUsb also runs on Windows7? If so, what would you suggest? I would gladly spend my money on purchasing a license but indeed would like to know firstly that it make sense.
Pleaese help me solving the problems.
Regards, Henny

Henny Barten

  • Newbie
  • *
  • Posts: 32
    • View Profile
Hi Roman,
Thinking over my problem as described, since you agree that the documentation has room for improvements, maybe due to that I make some wrong conclusions.
Maybe a silly question, but so far I understood that (e.g.) USBPipeDemo ALWAYS requires installation of WinUsb, for every USB target. I must say, I do have my doubts as the devices I try to evaluate already have their own driver installed. Now I get the impression that WinUsb is ONLY needed for the OSR-kit, is that right? If WinUsb is ONLY needed for the OSR-kit and NOT for other say 'standard' USB devices having their own driver, HOW can I then install the right  driver in USBPipeDemo. I read sometging about changing IdVendor and IdProduct but don't see how? Please tell me what to do.
Regards, Henny.

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Hello

Let me remind you some well-know thing about usb.

USB port is not RS232 port.
Windows needs driver for every usb device.
Windows supports some classes of USB devices (mouse, storages etc.) and provides built-in system drivers for such devices.

If you want to work with original USB device, you need develop original driver (kernel mode) and develop user mode application that can call driver functions.

So you need understand following:
nrComm Lib offers universal solution for low-level (pipe I/O or control request) access to USB device over two
universal (generic) usb drivers: nrUsb or WinUSB.
nrComm Lib can not use manufacturer's driver of device.

Please read this:
http://forums.nrcommlib.com/index.php?topic=1294.0

WinUSB and nrUsb can be installed on various USB devices.
We tested drivers with USB2RS232 adapters, BT sticks, USB modems.

OSR kit absolutely independent of WinUSB (or nrUsb) and   WinUSB (or nrUsb) do not related somehow with OSR kit board.

Possible you need to choose higher driver version and date time driver for override default USB driver. See TnrUsbDriver properties.

But please be careful and keep default USB drivers somewhere because TnrUsbDriver does not allow to rollback installation.

Roman Novgorodov
DeepSoftware LLC
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

Henny Barten

  • Newbie
  • *
  • Posts: 32
    • View Profile
Hi Roman,
Thanks for your this useful information. However, although it clarifies a lot, I still was not able to solve my problem.
Regarding "Possible you need to choose higher driver version and date time driver for override default USB driver. See TnrUsbDriver properties." I've found in my C:\Windows\Inf a file called "winusb.inf".
I assume, that could be what TnrUsbDriver is looking for. But inside this file I find: "DriverVer=06/21/2006,6.1.7601.17514" while the TnrUsbDriver Driverdate property mentions "19-2-2008 19:42:47". I find this strange because my laptop is roughly 1.5 year old and I assume that this file comes from the original W7 installation. So I googled at the Microsoft site to find a newer version of the WinUsb driver but found that I therefore need to download (and install??) the Windows Driver Kit "GRMWDK_EN_7600_1.ISO"
Anyway, is THIS the way to go???

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Hello

Thank you for your information.

Please note that nrComm Lib includes two demos
USBOsrKitDemo
USBOsrKitDemo-WinUsb

We tested first one with ordinary USB mouse. You need run it and check "Show all" for find your device.
After that you can click install driver. The nrUsb lightweight will be installed.
After that you need change some default settings of OSRKit demo: set correct PipIn and PipeOut IDs. You can run USB Browser tool and take a look pipe details for find correct IDs.

Roman Novgorodov
DeepSoftware LLC
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

Henny Barten

  • Newbie
  • *
  • Posts: 32
    • View Profile
Hi Roman,
I've done this already many times before and let me again explain what happens:
I ran "USBOsrKitDemo.exe"
I selected "ALL"
Edit box shows 2 USB apparatus
I selected "Logitech USB Trackman marble wheel"
Now various properties are shown with their values: e.g. Description,MaxPower,MaxPacketSize,VendorID,ProductID and some others
Then I hit the button "Install Driver"
Then a screen shows up showing:"nrUsb driver will be installed on selected device. Are you sure?"
I hit the YES-button
Then another screen pops up "Usb driver installation. Please"
Also another screen pops up at the same time:"You are using trial nrCommLib version! Please register!"
I hit the OK-button
Now another screen pops up:"Driver installation failed. Access denied"

I'm the ONLY user on this Windows-7 laptop and checked if I'm the administrator, and I am!
So I'm 100% sure that I do have the administrator rights.
I did the same thing on another Windows-7 laptop, also as administrator, but also "Driver installation failed. Access denied".
On both computers I can install any program I like, so NO problem so far with administator rights.
I do have also a Windows-XP laptop and will try the same thing soon on that computer as I think it might be a Windows-7 problem.

Question: Did ANYONE ever do the same thing on a Windows-7 computer with GOOD results? Please let me know.

Regards, Henny

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Hello

Our test platform is Win7 x64. All works fine.
Please check that you turned off UAC on your Win7.
Also possible you can grant me access to problem win7 over TeamViwer and I will try to look at place.
If you can, send to me private message with TeamViewer logon info.

Also you can give more details if show debug log file of installation process. You need attach TnrLogFile component to TnrUsbDriver component and set detail level to dlDebug. Possible log file shows some useful info.

Roman Novgorodov
DeepSoftware LLC
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

Henny Barten

  • Newbie
  • *
  • Posts: 32
    • View Profile
Hi Roman,

Thank you so much for your support. This was really usefull! ;D
In the meantime I already found out that I do NOT encounter such driver install problem using Windows XP.
Now,. due to your answer, ;D I solved the problem on Windows 7! Great!
Without your help I would never have thought about UAC as being the reason of this problem.
To be honest, it still sounds strange to me as I did not have any problem on all other software installations so far, anyway...
Now fortunately I can continue my investigations. ;) :P

Regards, Henny.

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Hello

Thank you for positive feedback.
We will glad to help you any time.

Good luck!

Roman Novgorodov
DeepSoftware LLC
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

Henny Barten

  • Newbie
  • *
  • Posts: 32
    • View Profile
Hi Roman,

Today I tried on my PC running on Windows XP USBDriverDemo, selected my PC Camera (USB Composite Device) and after hiiting "Install WinUSB driver" I got the error message: "Driver installation failed. The system cannot find the file specified".
What should I do as I would like to do some experiments with usb pipe demo.
Regards, Henny

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Hello

Does demo create any LOG file during this testing? Please upload it here.

Roman Novgorodov
DeepSoftware LLC
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

Henny Barten

  • Newbie
  • *
  • Posts: 32
    • View Profile
Hi Roman,

To my opinion this demo does not include a log facility.
So I tried to add it but unfortunately, I do not see any log file afterwards.
I might be still too unfamiliar with the log file implementation but tried to implement it the same way as you've implemented it in LPT_demo. I included my not working solution in a zip file. Please tell me what to change and why= so I can learn from it.

Thanks, Henny

« Last Edit: October 11, 2011, 05:00:21 pm by Henny Barten »

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Hello

We compiled your code with our XE2 and tested with our usb device. All works fine.
You can try run Dbgview.exe tool for catch Kernel debug messages. Show me its log.

Can you grant me TeamViewer access to your PC with connected usb device? I can try to check at place. Send me logon details over email.

Roman Novgorodov
DeepSoftware LLC
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.