• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1]
Author Topic: with gcc and makefile to develop the USB device using C language  (Read 4009 times)
kelvinxurx
Newbie
*

Karma: 0
Posts: 6


View Profile
« on: January 25, 2010, 02:16:13 AM »

hello, I'm a newbie to the linux. I'm trying to get my plug to work with gcc and makefile to develop the USB device using C language. for example, can read and write from USB device. anyone can advise about this,  and any documentation available for plug computer?   thank you!
Logged

MarkF
Full Member
***

Karma: 6
Posts: 125


View Profile
« Reply #1 on: January 25, 2010, 04:06:23 AM »

Do you want to write an application that reads and writes a USB device or do you want to write a device driver that lets applications read and write a USB device?  The answer to this will help to point you to documentation on Linux development that you should read.

EDIT: If you are wanting to learn about Linux device drivers, here is an on-line source.  It is a little dated (this is rev 3 and rev 4 is out); but, it gives a pretty good overview.

In either case, it would be possible to develop on a larger machine (a PC running the same flavor of Linux as you will put on the Plug) and then re-compile your code for the Plug once you get the logic bugs out.
« Last Edit: January 25, 2010, 06:22:26 AM by MarkF » Logged

Mark

kelvinxurx
Newbie
*

Karma: 0
Posts: 6


View Profile
« Reply #2 on: January 25, 2010, 08:48:15 AM »

Mark, thank you for your reply. actually I'm developping the embedded server project using the plug computer, this server connect to some USB devices , such as USB keyboard, printer and thumb driver. ethernet connct to PC server. communicate each other from PC to USB device. it is an application.
Logged

MarkF
Full Member
***

Karma: 6
Posts: 125


View Profile
« Reply #3 on: January 25, 2010, 12:56:42 PM »

As an application, you (mostly) do not have to worry about how the device is connected to the CPU.  This is (mostly) hidden in the OS.  I would suggest you look for a text on Linux to understand the design philosophy and/or application programming model of Linux.

As an example, a thumb drive looks like any disk drive which has a filesystem and files on it.  In Linux, drives are mounted at places in the filesystem.  On my Plug, part of my Network Attached Storage unit is mounted at /mnt/nas.  This means I can see everything on that network share by looking at the directory structure that starts at /mnt/nas/....  Again, the point is: you, as an application writer, do not have to take USB into account.
Logged

Mark

kelvinxurx
Newbie
*

Karma: 0
Posts: 6


View Profile
« Reply #4 on: January 25, 2010, 10:19:19 PM »

Hi,

I have the USB HID keyboard and plug into USB port of PlugCompter. get the 'usbdev1.2...' under /dev only. how can I get key value when key is pressed. do I need to build USB HID lib into the kernel?

another question is that: I can compile the gcc -o hello hello.c at my working directory. I put gcc -o hello hello.c to makefile and type make, it give out 'command not found'. how to make the makefile working?
Logged

MarkF
Full Member
***

Karma: 6
Posts: 125


View Profile
« Reply #5 on: January 26, 2010, 06:21:39 AM »

Again, you don't have to be concerned that the keyboard is USB.  If you are building a console application, STDIN will be assigned to the keyboard (most of the time) so use the C language constructs to get input from STDIN.  If you are building a graphical application, the framework will have a way to get input from the keyboard (probably by handling a message or two).

To get the make command:
apt-get install build-essential
or
apt-get install make
Logged

Mark

kelvinxurx
Newbie
*

Karma: 0
Posts: 6


View Profile
« Reply #6 on: January 27, 2010, 12:04:04 AM »

Hi,

I can download documents for application programming of Linux from internet. but not any for PLugComputer.
do you know some weblink about it?

thank you!

Logged

MarkF
Full Member
***

Karma: 6
Posts: 125


View Profile
« Reply #7 on: January 27, 2010, 06:49:40 AM »

Linux is Linux.  If you write an application that runs on some flavor of Linux, it can be recompiled to run on (pretty much) any machine running that flavor of Linux.  I have written many programs on a PC running Linux.  Then I have recompiled them and they run on the Plug.

For Plug specifics, look at the other parts of this board.  For whatever reason, you started this thread is in a section that is not really for development discussion (it is for a specific announcement).

For example, take a look in the General Linux Questions area.  There are threads about cross-compiling and many more topics there.
Logged

Mark

kelvinxurx
Newbie
*

Karma: 0
Posts: 6


View Profile
« Reply #8 on: February 01, 2010, 08:20:10 AM »

Hi,

Now I'm try to set up my development environment of Linux Host (Ubuntu desktop) with NFS to program application of Plug Computer . can you advise me how to configuration this?
   
Logged

MarkF
Full Member
***

Karma: 6
Posts: 125


View Profile
« Reply #9 on: February 01, 2010, 11:16:53 AM »

Take a look at this wiki/how to: http://plugcomputer.org/plugwiki/index.php/Scratchbox2_based_cross_compiling
Logged

Mark

kelvinxurx
Newbie
*

Karma: 0
Posts: 6


View Profile
« Reply #10 on: February 04, 2010, 09:42:59 AM »

Hi.

after install NFS and tftp server, reset Sheevaplug , got info as below, Pls help take a look what wrong with it:

......
TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
md: Autodetecting RAID arrays.
md: autorun ...
md: ... autorun DONE.
Looking up port of RPC 100003/2 on 192.168.0.10
rpcbind: server 192.168.0.10 not responding, timed out
Root-NFS: Unable to get nfsd port number from server, using default
Looking up port of RPC 100005/1 on 192.168.0.10
rpcbind: server 192.168.0.10 not responding, timed out
Root-NFS: Unable to get mountd port number from server, using default
Logged

peter a
Jr. Member
**

Karma: -2
Posts: 89


View Profile
« Reply #11 on: April 13, 2010, 07:07:31 AM »

in the words of monty python .... spam spam spam
Logged

jmae1925
Newbie
*

Karma: 0
Posts: 1


View Profile WWW
« Reply #12 on: July 07, 2010, 02:27:21 AM »

Nice one...
Logged


Pages: [1]
Print
Jump to: