Re: [PATCH] USB: add USB test and measurement class driver - round 2



On Fri, Aug 29, 2008 at 12:57:54AM -0600, stefan_kopp@xxxxxxxxxxx wrote:
Hi all,

I haven't been able to follow all the enhancements you did to the
driver, but I can comment on the ratioale behind the orignal driver.

The original driver used minor number 0 for "driver communication" (in
contrast to "device communication"). The main purpose was to get a
list of the USBTMC devices attached by doing a "cat /dev/usbtmc0"
(which would point to minor number 0). The first device found would
then use the next free minor number, usually 1. I believe the concept
of "driver communication" has been removed from the driver, so a
single minor number for a single device should be it.

cating that file was sending out a text file to userspace that needed to
be parsed, like a /proc file. Now you can just look at all of the
devices in /sys/class/usb/usbtmc* to see all of the different devices in
the system.

The issue with using cat on the shell level is that it uses fread
which has the (in this case) ugly behaviour of recalling the driver's
read method until the full number of characters requested has been
accumulated (or until zero characters are returned, indicating the end
of file). With USBTMC instruments, this behavour is bad because the
retry will not just return zero characters, it will cause a timeout
with the associated error condition in the device. So, to enable the
use of echo/cat, I added some fread handling to the driver (which
catches the retries). I believe this also has been removed, so I
assume cat/fread will not work (?).

I do not know, but we do not do wierd things in the kernel just because
of broken userspace programs. This logic should be done in userspace,
and programs should look at the return value of read() and handle it
properly. Otherwise it is a bug.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: OpenGL-based framebuffer concepts
    ... graphics framework into the realm of possibility just in userspace. ... Running the video ROM at boot to reset cards, ... With exokernels each driver presents a unique API ... > support for an overlaid kernel console. ...
    (Linux-Kernel)
  • Re: [linux-dvb] [PATCH] Userspace tuner
    ... We keep format conversion ... code duplication in userspace since there's no library available at the ... it is convenient for apps to be able to use standard libraries ... access to it should be part of its driver. ...
    (Linux-Kernel)
  • Re: [PATCH] [UIO] Add alignment warnings for uio-mem
    ... would silently align it and the corresponding attributes in sysfs would ... The userspace part of the driver expects a 16 bytes range but is told ... I'd like to suggest the following solution (patch at the end of this ...
    (Linux-Kernel)
  • Re: [RFC][PATCH 2.6.13-rc6] add Dell Systems Management Base Driver (dcdbas) with sysfs support
    ... >> the kernel tree. ... > is doing with the open source dcdbas driver and all of the other SMI ... SMI from userspace can be tricky, ... Reading/writing the values behind the CMOS/SMI tokens (BIOS F2 ...
    (Linux-Kernel)
  • Re: ISE/EDK Kubuntu linux installation issues
    ... Note this applies to the USB driver. ... Next download the userspace shim sources from http://www.rmdir.de/~michael/xilinx/ and compile them. ... Ensure the script permissions are set with chmod +x. ... By putting an executable shell script directly in the places where callers look for it, you can add the prelink and the Linux system libaries will sort out whether it's executing a binary or a shell script. ...
    (comp.arch.fpga)